2 sample application – IBM Data Server DB2 User Manual
Page 170
156
DB2 Deployment Guide
When DB2 CLI driver works without the ODBC driver manager, it supports a
subset of the functions provided by the ODBC driver. For a detailed description
of the supported functions, visit the DB2 Information Center:
The name of the isolation levels in a DB2 environment differs from the ODBC
specifications. Table 4-4 maps the isolation levels in DB2 to ODBC.
Table 4-4 Isolation level mapping between ODBC and DB2
4.3.2 Sample application
To demonstrate the deployment, we create a sample CLI application. We do not
implement complex logics in the application because we use it only for a
demonstration in subsequent deployment. The complete source code is shown in
A.1, “C/C++” on page 259 and is available for download. For the download
instructions, refer to Appendix B, “Additional material” on page 267.
In this application, we use DSN-less connection. It is the first method in our
discussion. See “Connecting to database” on page 158. This means that we do
not have to create a file DSN or register the data source with the ODBC driver
manager. The connectivity information is read from the application command
line, then saved in a connection string, and finally passed to SQLDriverConnect()
as a parameter.
If the connection fails, the application will get diagnostics data from the
connection handle, and send it to the standard output for our attention. The
output consists of SQLCODE, SQLSTATE, and an explanatory error message.
After the deployment of this application, we test it to know if deployment is
successful or not according to the result of this connection.
IBM isolation level
ODBC isolation level
Cursor stability
SQL_TXN_READ_COMMITTED
Repeatable read
SQL_TXN_SERIALIZABLE_READ
Read stability
SQL_TXN_REPEATABLE_READ
Uncommitted read
SQL_TXN_READ_UNCOMMITTED
No commit
(no equivalent in ODBC)