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:

http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db2.luw.apdv

.cli.doc/doc/c0000670.html

The name of the isolation levels in a DB2 environment differs from the ODBC specifications. Table 4-4maps the isolation levels in DB2 to ODBC.

Table 4-4 Isolation level mapping between ODBC and DB2

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)

 

 

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.

156DB2 Deployment Guide

Page 170
Image 170
IBM manual Sample application, Isolation level mapping between Odbc and DB2