Previous Topic Next topic Print topic


INIT

Generates a CONNECT statement to initialize SQL. This option is disabled if it is used within an OO program.

Syntax:

INIT={PROT | S | X }
NOINIT

Parameters:

PROT In the event that the application terminates abnormally, correctly closes down the database connection and rolls back all changes since the last COMMIT, avoiding potential database corruption.
S Database to be used in shared mode
X Database to be used in exclusive mode

Properties:

Default: NOINIT

Comments:

  • Set INIT only once for each application. Do not set INIT for SQL programs called by other SQL programs. Instead, specify the INIT option for the first SQL program executed in a run unit. Compiling more than one module in an application with the INIT option could cause your program to terminate abnormally.
  • If you use DB2 LUW 7.2 with fixpack 8 or later, do not compile an application using both the INIT and the PASS directives. Instead, we recommend that you code a CONNECT statement directly into your programs. Because these versions of DB2 LUW generate an SQL error when host variables are passed with spaces or low values on a CONNECT, INIT does not generate the CONNECT statement with the blank host variables needed by the PASS directive for the user ID and password.
  • In some additional circumstances, you might find it best to code a CONNECT statement into your programs rather than using the DB2(INIT) directive. Consider the following:
    • In the past, IBM has occasionally changed the equivalent APIs used in the SQL CONNECT statement. Therefore, we cannot guarantee that the implicit code generated by the DB2(INIT) compiler directive will function with new releases of DB2 LUW.
    • Because the DB2(INIT) directive can generate and store user ID and password information, security is a consideration.
Previous Topic Next topic Print topic