SQL support / Database connections |
For development or testing purpose, connection parameters can be provided in the database specification string passed to the DATABASE and CONNECT TO instructions. Do not hard code connection specification parameters in programs to be installed on a production site, use the indirect database specification method instead, or build the connection string at runtime, to keep the database connection flexible.
The connection specification parameters override the dbi.database connection parameters defined in FGLPROFILE.
A + plus sign in the database specification starts the list of connection parameters. Each parameter is defined with a name followed by an equal sign an a value enclosed in single quotes. Connection specification parameters must be separated by a comma:
dbname+parameter='value'[,...]
In this syntax, parameter can be one of the following:
Parameter | Description |
---|---|
resource | Specifies which 'dbi.database'entries have to be read from the FGLPROFILE configuration file. When this property is set, the database interface reads dbi.database.name.* entries, where name is the value specified for the resource parameter. |
driver | Defines the database driver library to be loaded (filename without extension). |
source | Specifies the data source of the database. |
username | Defines the name of the database user. |
password | Defines the password of the database user. Important: You should not hard code the user
passwords in your sources!
|
In the next example, driver, source and resource are specified in the connection string:
MAIN DEFINE db CHAR(50) LET db = "stores+driver='dbmora',source='orcl',resource='ora'" DATABASE db ... END MAIN