To compile a DB2 LUW program, you must first connect to a database. The database itself is specified by the DB2 ECM directive, DB. User credentials are also provided to the compiler by the DB2 ECM preprocessor. The login credentials used to connect to the database can vary depending on whether the database is local or remote, what DB2 compiler directive options have been specified, and what environment variables have been set.
The DB2 ECM checks for login credentials in one or more places and in a particular sequence, and attempts to connect using the credentials provided in each place until the connection succeeds.
When you specify login credentials using PASS, they take precedence over credentials supplied by any other means. If the connection succeeds using the credentials provided, then compilation proceeds. PASS is required to connect to a remote DB2 database. If the connection fails using the credentials provided by PASS, the DB2 ECM next looks for the SQLPASS.TXT environment variable.
See PASS for details.
This option is used only when no credentials have been supplied using the PASS compiler directive option, or if the credentials supplied by PASS fail to enable the connection. If the connection succeeds, then compilation proceeds.
If the SQLPASS.TXT environment variable is not set, or if the connection fails using the credentials provided, the DB2 ECM next looks at the operating system credentials.
See SQLPASS.TXT environment variable for details.
If you have not specified login credentials using the PASS compiler directive option, nor have you set the SQLPASS.TXT environment variable, or if either or both of those approaches yield unusable credentials, the DB2 ECM attempts to make the connection using your current Operating System credentials. This compilation attempt can succeed only if you are using a local database. If you are using a remote database, please consider using the PASS directive, which consistently works across all platforms.
If the connection fails using your Operating System credentials, the DB2 ECM prompts you for login credentials.
If the DB2 ECM fails to connect to the database after exhausting all other methods of obtaining login credentials, or has failed in all previous attempts to connect to the database, it prompts you for credentials by invoking the SQL Logon dialog box.
When you check Save, the credentials supplied here are stored in the memory of your local machine and remain there until you reboot or until you remove the information from memory by issuing the MFDAEMON CLOSE command at aa Visual COBOL command prompt.