The Db2 ODBC run time environment

Db2 ODBC support is implemented as an IBM® C/C++ Dynamic Load Library (DLL). All API calls are routed through the single ODBC driver that is loaded at run time into the application address space.

Because Db2 ODBC support is provided as a DLL, Db2 ODBC applications do not need to link-edit any Db2 ODBC driver code with the application load module. Instead, the linkage to the Db2 ODBC APIs is resolved dynamically at run time by the IBM Language Environment® run time support.

The Db2 ODBC driver can use either the call attachment facility (CAF) or the Resource Recovery Services attachment facility (RRSAF) to connect to the Db2 for z/OS® address space.
  • If the Db2 ODBC application is not running as a Db2 for z/OS stored procedure, the MVSATTACHTYPE keyword in the Db2 ODBC initialization file determines the attachment facility that Db2 ODBC uses.
  • If the Db2 ODBC application is running as a Db2 for z/OS stored procedure, then Db2 ODBC uses the attachment facility that was specified for stored procedures.

When the Db2 ODBC application invokes the first ODBC function, SQLAllocHandle() (with HandleType set to SQL_HANDLE_ENV), the Db2 ODBC driver DLL is loaded.

The following versions of the ODBC driver are available on Db2 for z/OS:

  • the 31-bit XPLINK driver
  • the 31-bit non-XPLINK driver
  • the 64-bit driver

You specify which driver your application uses by which definition sidedeck you include when you prelink and link-edit your application.

Db2 ODBC supports access to the local Db2 for z/OS subsystems and any remote data source that is accessible using Db2 for z/OS Db2 13. This includes:
  • Remote Db2 subsystems using specification of an alias or three-part name
  • Remote DRDA-1 and DRDA-2 servers using LU 6.2 or TCP/IP.

The relationship between the application, the Db2 for z/OS ODBC driver and the Db2 for z/OS subsystem are illustrated in the following figure.

Figure 1. Relationship between Db2 for z/OS ODBC components
Begin figure summary. This figure is a flowchart that depicts the path that a DB2 ODBC application uses to access a DB2 for z/OS subsystem and other data sources. Detailed description available.