Troubleshooting
Problem
ODBC application connecting to DB2 encounters a segmentation fault when retrieving null values due to 32-bit / 64-bit mismatch of ODBC driver
Cause
This problem occurs because the ODBC driver library that is specified in the ODBC configuration does not match the bitness of the application
Diagnosing The Problem
View/edit the contents of the ODBC INI file and verify the value specified for the "Driver".
For example:
[DB2]
Description = DB2 Driver
Driver =/apps/UNIXodbc/odbc_cli/clidriver/lib/libdb2.so
FileUsuage =1
DontDLClose =1
Typically either: User INI file (.odbc.ini) or the system INI file (odbcinst.ini)
Resolving The Problem
Ensure that the correct driver is specified that matches the bitness of the application.
As in the example above, the segmentation fault occurs because libdb2.so is specified (which is the 32-bit ODBC driver) whereas the application is 64-bit so the driver should be pointing to libdb2o.so (which is the 64-bit ODBC driver). The line should then read:
Driver =/apps/UNIXodbc/odbc_cli/clidriver/lib/libdb2o.so
See Setting up the ODBC environment (Linux and UNIX) to see which ODBC driver library should be used depending on the operating system / bitness of the application.
Type of application | DB2 driver to specify |
32-bit ODBC Driver Manager | libdb2.* |
64-bit ODBC Driver Manager | libdb2o.* (db2o.o for AIX) |
Note: The file extension of the DB2 driver to specify depends on the operating system. The extensions are as follows:
- .a - AIX
- .so - Linux, Solaris, HP-IPF
- .sl - HP-PA
Related Information
Was this topic helpful?
Document Information
Modified date:
16 June 2018
UID
swg21689265