database.cfg
database.cfg
is used to connect to databases.
QPM creates a template for database.cfg that can be modified by a 4gl developer.
This template is called template_database.cfg and is located in the default Lycia configuration folder:
C:\Program Files\Querix\Lycia\etc
/opt/Querix/Lycia/etc/
To create database.cfg, you must
- create a copy of template_database.cfg,
- move this copied file to your configuration folder specified by LYCIA_CONFIG_PATH,
- rename it to database.cfg, and
- change the default contents of the file in the way you need.
If you do not move your database.cfg to the configuration folder specified by LYCIA_CONFIG_PATH, it will be rewritten when you update Lycia.
Its structure when a database
configuring should be as follows:
dbname {
driver = "dbtype"
source = "database"
username = "user"
password = "pwd"
}
The options listed above
should have the following values:
- database_alias = the alias that will be used in 4GL code as the database name, for example, in the DATABASE statement or in the CONNECT TO statement;
- driver = its values should be of the database type. This parameter is optional, if it is not set the value of the LYCIA_DB_DRIVER variable will be taken as the driver. It can be one of these: informix, oracle, or odbc;
- source = its values should be the name of the database as it is specified on the database server. For Informix, it can be database@server specification. For Oracle, it should be tnsname. This parameter is optional, if it is not set for the given database connection, the database alias is treated as the source;
- username = should contain the login of the user. This parameter is optional;
- password = should contain the access password for the given user login. Note that the password is stored as a plain text. This parameter is optional. For the security reasons use the USING clause of the CONNECT TO statement instead.
A single database.cfg
file
may contain several database specifications without no limits for their
number. Here is an example of this file containing two database specifications:
or_db {
driver = "oracle"
source = "stores"
username = "john"
password = "123456"
}
ifx_db {
driver = "informix"
source = "stores@ixserv"
username = "jane"
password = "567890"
}