Deprecated ODBC functions and their replacements

The ODBC 3.0 functions replace, or deprecate, many existing ODBC 2.0 functions. The Db2 ODBC driver continues to support all of the deprecated functions.

Recommendation: Begin using ODBC 3.0 functional replacements to maintain optimum portability.

The following table lists the ODBC 2.0 deprecated functions and the ODBC 3.0 replacement functions.

Table 1. ODBC 2.0 deprecated functions
ODBC 2.0 deprecated function Purpose ODBC 3.0 replacement function
SQLAllocConnect() Obtains an connection handle. SQLAllocHandle() with HandleType=SQL_HANDLE_DBC
SQLAllocEnv() Obtains an environment handle. SQLAllocHandle() with HandleType=SQL_HANDLE_ENV
SQLAllocStmt() Obtains an statement handle. SQLAllocHandle() with HandleType=SQL_HANDLE_STMT
SQLColAttributes() Gets column attributes. SQLColAttribute()
SQLError() Returns additional diagnostic information (multiple fields of the diagnostic data structure). SQLGetDiagRec()
SQLFreeConnect() Frees connection handle. SQLFreeHandle() with HandleType=SQL_HANDLE_DBC
SQLFreeEnv() Frees environment handle. SQLFreeHandle() with HandleType=SQL_HANDLE_ENV
SQLFreeStmt() with fOption=SQL_DROP Frees a statement handle. SQLFreeHandle() with HandleType= SQL_HANDLE_STMT
SQLGetConnectOption() Returns a value of a connection attribute. SQLGetConnectAttr()
SQLGetStmtOption() Returns a value of a statement attribute. SQLGetStmtAttr()
SQLParamOptions() Sets multiple values at one time for each bound parameter. SQLSetStmtAttr()
SQLSetConnectOption() Sets a value of a connection attribute. SQLSetConnectAttr()
SQLSetParam() Binds a parameter marker to an application variable. SQLBindParameter()
SQLSetStmtOption() Sets a value of a statement attribute. SQLSetStmtAttr()
SQLTransact() Commits or rolls back a transaction. SQLEndTran()