invalid magic number

Help
2008-09-29
2013-05-08
  • Stephen Giles

    Stephen Giles - 2008-09-29

    Hi,

    I am trying to use the iodbctest program to validate the an ODBC connection to a DB2 database from UNIX.

    When I run the test program it fails because the driver cannot be loaded

    Attached is the output

    iODBC Demonstration program
    This program shows an interactive SQL processor
    Driver Manager: 03.52.0507.0105
    1: SQLDriverConnect = [iODBC][Driver Manager]   0509-022 Cannot load module /CML/db2/home/dbtjei/sqllib/lib/libdb2.a.
            0509-103   The module has an invalid magic number. (0) SQLSTATE=00000
    2: SQLDriverConnect = [iODBC][Driver Manager]Specified driver could not be loaded (0) SQLSTATE=IM003

    I thought it may be 32/64 bit related, so I have tried to run the application from the 32 library and the 64bit library
    ie  bin64/iodbctest DSN=TZEIJ0
    and bin32/iodbctest DSN=TZEIJ0

    however both produce the same error.

    The path statement is
    PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/local/bin:.:/usr/opt/mqsi/bin:/RTS/db2/home/dbtjei/sqllib/bin:/RTS/db2/home/dbtjei/sqllib/adm:/RTS/db2/home/dbtjei/sqllib/misc:/opt/oracle/v9.2.0/bin:/opt/oracle/v9.2.0/bin:.:/usr/local/bin:

    The output from trace is
    Application     00000001 EXIT  SQLDriverConnect with return code -1 (SQL_ERROR)
                    SQLHDBC           30018748
                    SQLPOINTER        0x0
                    SQLCHAR         * 2ff21fe0
                    SQLSMALLINT       -3 (SQL_NTS)
                    SQLCHAR         * 3000da40
                    SQLSMALLINT       4096
                    SQLSMALLINT     * 2ff21bc4
                    SQLUSMALLINT      1 (SQL_DRIVER_COMPLETE)

    Application     00000001 EXIT  SQLGetDiagRec with return code 0 (SQL_SUCCESS)
                    SQLSMALLINT       2 (SQL_HANDLE_DBC)
                    SQLHDBC           30018748
                    SQLSMALLINT       1
                    SQLCHAR         * 2ff21944
                                      | 00000                                    |
                    SQLINTEGER      * 2ff21940 (0)
                    SQLCHAR         * 2ff21954
                                      | [iODBC][Driver Manager]     0509-022 Cannot
    |
                                      | load module /CML/db2/home/dbtjei/sqllib/ |
                                      | lib/libdb2.a.
            0509-103   The module has |
                                      |  an invalid magic number.                |
                    SQLSMALLINT       512
                    SQLSMALLINT     * 0x0

    Application     00000001 EXIT  SQLGetDiagRec with return code 0 (SQL_SUCCESS)
                    SQLSMALLINT       2 (SQL_HANDLE_DBC)
                    SQLHDBC           30018748
                    SQLSMALLINT       2
                    SQLCHAR         * 2ff21944
                                      | IM003                                    |
                    SQLINTEGER      * 2ff21940 (0)
                    SQLCHAR         * 2ff21954
                                      | [iODBC][Driver Manager]Specified driver  |
                                      | could not be loaded                      |
                    SQLSMALLINT       512
                    SQLSMALLINT     * 0x0

    It would be good to get any suggestions on how to fix the problem or how to get additional information to solve the problem.

    Thanks
    Stephen

     
    • iODBC Maintainer

      You cannot use a static library as an ODBC driver, which is why your C library dlopen function returns this "invalid magic number" error message.

      An ODBC Driver is typically build as a shared module ending in a .so or .sl suffix. It has been specially compiled to be relocatable, so it can be inserted into another process space at runtime.

      Please check your system to see if you have a libdb2.so file in the same directory as you found your libdb2.a file.

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks