IBM Support

ODBC application connecting to DB2 encounters a segmentation fault when retrieving null values due to 32-bit / 64-bit mismatch of ODBC driver

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 applicationDB2 driver to specify
32-bit ODBC Driver Manager libdb2.*
64-bit ODBC Driver Managerlibdb2o.* (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

[{"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Programming Interface - ODBC","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"}],"Version":"10.1;10.5;9.5;9.7","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
16 June 2018

UID

swg21689265