To meet your needs, we constantly work to improve Querix products.
This means that Lycia documentation is developing as well.
In case you have found a certain dissonance between the provided information and the actual behavior of Lycia 3 and/or your applications, please, let us know about this via documentation@querix.com so that we can introduce the necessary changes to our documentation.
Thank you for your attention and cooperation.
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, there may be a set of cases when some parameters are missing and some are set twice.
Generally speaking CONNECT TO is of the 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 in order to enable the usage of different database drivers within an application.
The following table shows the result of some parameters being set twice or not being set at all.
Parameter |
Set in CONNECT TO |
Set in database.cfg |
Used Value |
driver |
|||
database.cfg |
|||
no |
-d flag for program launching is used. If it is not passed - LYCIA_DB_DRIVER value will be used. |
||
source |
|||
database.cfg |
|||
The dbname value is treated as source. |
|||
username |
|||
database.cfg |
|||
DB-specific settings are used, if they are not set then program tries to connect with no username |
|||
password |
|||
database.cfg |
|||
Legacy settings are used, if they are not set then program tries to connect with no password |
Here is an example with not all optional parameters present:
stores {
driver = "oracle"
username = "john"
password = "123456"
}
ifx_db {
source = "stores@ixserv"
}
If we use the CONNECT TO without optional clauses, we will get:
In the case of stores connection setting the program will look for the tnsname 'stores' in the tnsnames.ora file and use the specified login and password for connection.
In the case of inf_db connection setting, it will look for the database named 'stores' on the ixserver Informix database server, if the program is launched with -d informix flag. If it is launched without this flag, the runtime error will occur. If the value of the flag is not 'informix', but, for example, 'oracle', the program will look for the tnsname ' stores@ixserv ' in the tnsnames.ora file and would most probably also throw an error.