ODBC 64-bit Windows and Linux Considerations

 

Identify header files and data types when using the ODBC driver in an iSeries Access for Windows or iSeries Access for Linux environment. The iSeries Access ODBC driver implements support for 64-bit ODBC APIs. In general, the support is implemented as defined in the ODBC header files provided by Microsoft® for Windows® environments and unixODBC for Linux® environments. When writing code to call the ODBC APIs, refer to the appropriate ODBC header file for the function prototype. The header files are listed below.

There is one case, SQLExtendedFetch, that is handled differently in Linux than what is defined in sqlext.h. In sqlext.h, the definition for the pcrow parameter is defined as a SQLROWSETSIZE pointer. SQLROWSETSIZE is a 4 byte value in 64-bit Linux implementations. Despite this, the ODBC driver returns data for the pcrow pointer as an 8 byte (64-bit) value to be consistent with its 64-bit Windows ODBC implementation. Some inherent differences between Windows, Linux, and 64-bit are identified below.

Some common C/C++ types and the size of each are listed in the table below.

Table 1. Common C/C++ types and the size of each
C/C++ Type Linux 64-bit Windows 64-bit Linux 32-bit Windows 32-bit
int 4 4 4 4
long 8 4 4 4
long long 8 Not defined 8 Not defined
LONG LONG Not defined 8 Not defined Not defined
pointer size 8 8 4 4
INT32 Not defined 41 4 Not defined 41 4
INT64 Not defined 81 8 Not defined 81 8
SQLSMALLINT 2 2 2 2
SQLINTEGER 4 4 4 4
SQLLEN 8 8 4 4
SQLSETPOSIROW 8 8 2 2
SQLROWCOUNT 8 Not defined 4 4
SQLROWSETSIZE 4 Not defined 4 4
SQLROWOFFSET 8 Not defined 4 4
SQLPOINTER 8 8 4 4
UINT_PTR Not defined 81 8 Not defined 41 4
DWORD Not defined 41 4 Not defined 41 4
SDWORD Not defined 41 4 Not defined 41 4
ULONG_PTR Not defined 81 8 Not defined 41 4
SQLHANDLE 8 8 4 4
SQLHDESC 8 8 4 4

1. This type is not defined in a standard header file. It is defined in the toolkit provided with the iSeries Access for Linux product.

Options for the ODBC APIs listed below result in different behavior by the 32-bit and 64-bit ODBC drivers for parameter pointer data. Generally, the 64-bit ODBC drivers treat parameter pointer data as 8 byte (64-bit) values, unless otherwise noted.

SQLColAttribute

SQL_DESC_DISPLAY_SIZE

SQL_DESC_LENGTH

SQL_DESC_OCTET_LENGTH

SQL_DESC_COUNT

SQLColAttributes

SQL_COLUMN_DISPLAY_SIZE

SQL_COLUMN_LENGTH

SQL_COLUMN_COUNT

SQLGetConnectAttr

SQL_ATTR_QUIET_MODE

SQLGetConnectOption (This is mapped to SQLGetConnectAttr by the ODBC driver manager.)

SQL_ATTR_QUIET_MODE

SQLGetDescField

SQL_DESC_ARRAY_SIZE

SQLGetDiagField

SQL_DIAG_CURSOR_ROW_COUNT

SQL_DIAG_ROW_COUNT

SQL_DIAG_ROW_NUMBER

SQLGetInfo (These are all handled by the ODBC driver manager.)

SQL_DRIVER_HENV

SQL_DRIVER_HDBC

SQL_DRIVER_HLIB

SQL_DRIVER_HSTMT

SQL_DRIVER_HDESC

SQLGetStmtAttr

SQL_ATTR_APP_PARAM_DESC

SQL_ATTR_APP_ROW_DESC

SQL_ATTR_IMP_PARAM_DESC

SQL_ATTR_IMP_ROW_DESC

SQL_ATTR_MAX_LENGTH

SQL_ATTR_MAX_ROWS

SQL_ATTR_PARAM_BIND_OFFSET_PTR

SQL_ATTR_ROW_ARRAY_SIZE

SQL_ATTR_ROW_BIND_OFFSET_PTR

SQL_ATTR_ROW_NUMBER

SQL_ATTR_ROWS_FETCHED_PTR

SQL_ATTR_KEYSET_SIZE

SQLGetStmtOption (This is mapped to SQLGetStmtAttr by the ODBC driver manager.)

SQL_MAX_LENGTH

SQL_MAX_ROWS

SQL_ROWSET_SIZE

SQL_KEYSET_SIZE

SQLSetConnectAttr

SQL_ATTR_QUIET_MODE

SQLSetConnectOption (This is mapped to SQLSetConnectAttr by the ODBC driver manager.)

SQL_ATTR_QUIET_MODE

SQLSetDescField

SQL_DESC_ARRAY_SIZE

SQLSetStmtAttr

SQL_ATTR_APP_PARAM_DESC

SQL_ATTR_APP_ROW_DESC

SQL_ATTR_IMP_PARAM_DESC

SQL_ATTR_IMP_ROW_DESC

SQL_ATTR_MAX_LENGTH

SQL_ATTR_MAX_ROWS

SQL_ATTR_PARAM_BIND_OFFSET_PTR

SQL_ATTR_ROW_ARRAY_SIZE

SQL_ATTR_ROW_BIND_OFFSET_PTR

SQL_ATTR_ROW_NUMBER

SQL_ATTR_ROWS_FETCHED_PTR

SQL_ATTR_KEYSET_SIZE

SQLSetConnectAttr

SQL_MAX_LENGTH

SQL_MAX_ROWS

SQL_ROWSET_SIZE

SQL_KEYSET_SIZE

 

Parent topic:

iSeries Access for Linux Open Database Connectivity