Chapter 4. Deploying applications with DB2 155
DB2 CLI. In addition, some DB2 specific extensions have been added to DB2
CLI to facilitate programming with DB2 features. It conforms to ODBC 3.51.
Comparison of CLI and ODBC
The roles played by the DB2 CLI and ODBC driver might change due to the
differences in application environments.
Figure 4-1 illustrates the roles played by DB2 CLI and ODBC driver in different
environments. When an application accesses a DB2 database through an ODBC
driver manager, the DB2 CLI and ODBC driver behaves as an ODBC driver just
like other ODBC drivers, shown as A and B. The calls that the application sends
to the DB2 database have to go through the ODBC Driver Manager, DB2 ODBC
driver, and DB2 client before it can reach the DB2 server. Mapping and
transformation are made to these calls during the process. This is shown in the
left side of the diagram.
In the right side of Figure 4-1, when application calls DB2 CLI specifications,
there is no ODBC Driver Manager or other driver manager participating in the
action. The calls to a DB2 server are passed to the local DB2 Client immediately
by the DB2 CLI driver and the DB2 Client will communicate with the DB2 server
and forward the calls to it. As opposed to the ODBC environment, in here, DB2
CLI driver looks as if it is working as both driver manager and underlying driver.
Figure 4-1 ODBC vs. CLI
ODBC Driver Manager
Environment
DB2 CLI
Environment
Application
ODBC Driver Manager
Other
ODBC
driver
A
DBMS
A
Gateway
B
DB2
Client
DB2
CLI
driver
Application
DB2
server
DB2
Server
DB2
Mainframe/AS 400
DB2 connect
Other
ODBC
driver
B
DB2
ODBC
driver
DB2
Client
DB2 connect