"The module has an invalid magic number." when trying to use DB2's ODBC driver on AIX

Technote (troubleshooting)


Problem(Abstract)

When using an ODBC driver manager with DB2's ODBC driver on AIX, the application might fail with the following error:

0509-103 The module has an invalid magic number.

Cause

The DB2 ODBC library on AIX is an archived library called libdb2.a. Some ODBC driver managers load ODBC drivers dynamically and cannot work with archived libraries. They may therefore fail when trying to load the DB2 ODBC library on AIX from the ODBC driver manager.

For example, the unixODBC driver manager cannot use an archived library.


Resolving the problem

If this error occurs, you will want to ensure that you are linking the ODBC driver manager with a shared library as opposed to an archived library.

The DB2 ODBC library on AIX in DB2 v9.1 and greater is a hybrid library. This means that this library contains both 32-bit and 64-bit elements.

To generate a 32-bit shared library from the DB2 ODBC library on AIX, you will want to issue the following commands:


cd INSTHOME/sqllib/lib
ar -x libdb2.a
mv shr.o db2.o

where INSTHOME is the home directory of the instance owner.

To generate a 64-bit shared library from the DB2 ODBC library on AIX, you will want to issue the following commands:


cd INSTHOME/sqllib/lib
ar -x -X 64 libdb2.a
mv shr_64.o db2_64.o

where INSTHOME is the home directory of the instance owner.


You will then need to modify the ODBC driver manager's configuration file (usually odbcinst.ini) to point to the new shared library (db2.o for 32-bit, or db2_64.o for 64-bit), instead of the archived library (libdb2.a).

Related information

Setting up the unixODBC driver manager

Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

DB2 for Linux, UNIX and Windows
DB2 Programming Interfaces - ODBC

Software version:

9.1, 9.5, 9.7

Operating system(s):

AIX

Software edition:

Enterprise Server, Express, Personal, Personal Developer's, Workgroup Server

Reference #:

1422729

Modified date:

2010-03-09

Translate my page

Machine Translation

Content navigation