ODBC APIs and data types

Db2 ODBC supports a subset of the functions that the ODBC driver provides.

The following table summarizes the ODBC 3.0 application programming interfaces, ODBC SQL data types and ODBC C data types and whether those functions and data types are supported by Db2 ODBC.

Table 1. Db2 ODBC support
ODBC features Db2 ODBC
Core level functions All, except for:
  • SQLDrivers()
  • SQLGetDescField()
  • SQLSetDescField()
  • SQLGetDescRec()
  • SQLSetDescRec()
  • SQLCopyDesc()
Level 1 functions All, except for SQLBrowseConnect().
Level 2 functions All
Additional Db2 ODBC functions
  • SQLSetConnection()
  • SQLGetEnvAttr()
  • SQLSetColAttributes()
  • SQLGetLength()
  • SQLGetPosition()
  • SQLGetSubString()
  • SQLGetSQLCA()
Minimum SQL data types
  • SQL_CHAR
  • SQL_LONGVARCHAR
  • SQL_VARCHAR
Core SQL data types
  • SQL_DECIMAL
  • SQL_NUMERIC
  • SQL_SMALLINT
  • SQL_INTEGER
  • SQL_REAL
  • SQL_FLOAT
  • SQL_DOUBLE
Extended SQL data types
  • SQL_BIT
  • SQL_TINYINT
  • SQL_BIGINT
  • SQL_BINARY
  • SQL_BLOB
  • SQL_BLOB_LOCATOR
  • SQL_CLOB
  • SQL_CLOB_LOCATOR
  • SQL_DBCLOB
  • SQL_DBCLOB_LOCATOR
  • SQL_DECFLOAT
  • SQL_LONGVARBINARY
  • SQL_ROWID
  • SQL_TYPE_DATE
  • SQL_TYPE_TIME
  • SQL_TYPE_TIMESTAMP
  • SQL_VARBINARY
  • SQL_XML
ODBC 3.0 SQL data types
  • SQL_GRAPHIC
  • SQL_LONGVARGRAPHIC
  • SQL_VARGRAPHIC
Core C data types
  • SQL_C_CHAR
  • SQL_C_DOUBLE
  • SQL_C_FLOAT
  • SQL_C_LONG (SLONG, ULONG)
  • SQL_C_SHORT (SSHORT, USHORT)
Extended C data types
  • SQL_C_BINARY
  • SQL_C_BIT
  • SQL_C_BLOB_LOCATOR
  • SQL_C_CLOB_LOCATOR
  • SQL_C_DBCLOB_LOCATOR
  • SQL_C_DECIMAL64
  • SQL_C_DECIMAL128
  • SQL_C_TYPE_DATE
  • SQL_C_TYPE_TIME
  • SQL_C_TYPE_TIMESTAMP
  • SQL_C_TINYINT
ODBC 3.0 C data types
  • SQL_C_DBCHAR
Return codes
  • SQL_SUCCESS
  • SQL_SUCCESS_WITH_INFO
  • SQL_NEED_DATA
  • SQL_NO_DATA_FOUND
  • SQL_ERROR
  • SQL_INVALID_HANDLE
SQLSTATEs Mapped to X/Open SQLSTATEs with additional IBM® SQLSTATEs
Multiple connections per application Supported but type 1 connections, SQL_ATTR_CONNECTTYPE = SQL_CONCURRENT_TRANS. Must be on a transaction boundary prior to SQLConnect() or SQLSetConnection().