Db2 ODBC restrictions on the ODBC connection model

Db2 ODBC does not fully support the ODBC connection model if the initialization file does not specify MULTICONTEXT=1.

In this case, to obtain simulated support of the ODBC connection model, an application must specify CONNECTTYPE=1 either through the initialization file or the SQLSetConnectAttr() API.

An application that uses Db2 ODBC to simulate support of the ODBC model can logically connect to any number of data sources. However, the Db2 ODBC driver maintains only one physical connection. This single connection is to the data source to which the application last successfully connected or issued an SQL statement.

An application that operates with simulated support of the ODBC connection model, regardless of the commit mode, behaves as follows:
  • When the application accesses multiple data sources, it allocates a connection handle to each data source. Because this application can make only one physical connection at a time, the Db2 ODBC driver commits the work on the current data source and terminates the current connection before the application connects to a new data source. Therefore, an application that operates with simulated support of the ODBC connection model cannot open cursors concurrently at two data sources (including cursors WITH HOLD).
  • When the application does not explicitly commit or roll back work on the current connection before it calls a function on another connection, the Db2 ODBC driver implicitly performs the following actions:
    1. Commits work on the current connection
    2. Disconnects from the current data source
    3. Connects to the new data source
    4. Executes the function

When you enable multiple-context support (MULTICONTEXT=1), Db2 ODBC fully supports the ODBC connection model.