Indirect database specification method takes place when the database name used in the DATABASE or CONNECT TO instruction corresponds to a 'dbi.database.dbname.source' entry defined in the FGLPROFILE configuration file. In this case, the dbname database specification is used as a key to read the connection information from the configuration file.
In FGLPROFILE, the entries starting with 'dbi.database' group information defining connection parameters for indirect database specification:
dbi.database.dbname.source = "value" dbi.database.dbname.driver = "value" dbi.database.dbname.username = "value" dbi.database.dbname.password = "value" -- Warning: Password is not encrypted, do not use in production!
Keep in mind that FGLPROFILE entry names are converted to lower case when loaded by the runtime system. In order to avoid any mistakes, it is recommended to write FGLPROFILE entry names and program database names in lower case.
In the next example, the program specifies a data source with the name stores, and FGLPROFILE defines the source and driver parameters for the stores data source:
Program:
MAIN DATABASE stores ... END MAIN
FGLPROFILE:
dbi.database.stores.source = "stock@localhost:5432" dbi.database.stores.driver = "dbmpgs"
The indirect database specification technique is a flexible technique to define the database source: The database name in programs is a kind of alias for the real data source, which is defined in an external configuration file (i.e. FGLPROFILE), where entries can be easily changed on production sites without needing program recompilation.