The database connection can be set in the database.cfg file and then overridden by the CONNECT TO statement completely or partially. Since all the clauses of the CONNECT TO statement and the parameters of the database connection in the configuration file are optional, it may turn out that you haven't set some parameters and have set some other ones twice.
Generally speaking, CONNECT TO has higher precedence than database.cfg, and the latter overrides the environment variables settings and flags. The -d flag and environment variables are of the lowest precedence so that you could use different database drivers within one application.
This table shows the result of some parameters being set twice or not being set at all:
parameter |
resulting settings |
||
driver |
+ |
+ |
|
|
+ |
- |
|
|
- |
+ |
|
|
- |
- |
-d flag for program launching is used. If not, LYCIA_DB_DRIVER value is used |
source |
+ |
+ |
|
|
+ |
- |
|
|
- |
+ |
|
|
- |
- |
|
username |
+ |
+ |
|
|
+ |
- |
|
|
- |
+ |
|
|
- |
- |
db-specific settings are used. If not set, then the program will try to connect with no username |
password |
+ |
+ |
|
|
+ |
- |
|
|
- |
+ |
|
|
- |
- |
legacy settings are used. If not set, then the program will try to connect with no password |
In this example, some optional parameters are omitted:
stores {
driver = "oracle"
username = "john"
password = "123456"
}
ifx_db {
source = "stores@ixserv"
}