Obtain a unixODBC trace file using AcuSQL runtime


This article explains how to force the unixODBC driver to write a trace file when a program uses AcuSQL runtime to access a database.


To use an ODBC-compliant database (such as MySQL) on Linux, we need to configure unixODBC on the server. If you run into problems doing this, it is possible to create a unixODBC trace file by setting up odbcinst.ini in a manner like this:

mysql@linux:/home/mysql$ more /usr/local/etc/odbcinst.ini
ySQL ODBC 3.51 Driver]
Driver = /opt/mysql-connector-odbc-3.51.25r1093/driver/.libs/libmyodbc3.so
Setup = /opt/mysql-connector-odbc-3.51.25-linux-x86-32bit/lib/libmyodbc3S.so
UsageCount = 1

TraceFile = /tmp/odbc.trace
Trace = yes
UsageCount = 1

This generates an ODBC trace file and writes in it each ODBC operation performed with tools like "isql."

There is a problem with this, however; operations performed through AcuSQL runtime do not generate and access this trace file.


This happens because AcuSQL runtime is linked to different libraries from "isql" (which is probably linked directly to MySQL Connector), and AcuSQL runtime does not use ODBC driver libraries.

To solve this issue, we need to relink the runtime to the same libraries that "isql" uses.

  1. First, identify the linked libraries using "ldd":

    mysql@linux:/home/mysql$ ldd /opt/Acucbl810/bin/runcbl
    linux-gate.so.1 => (0xb7f7a000)
    libmyodbc3-3.51.25.so => /opt/mysql-connector-odbc-3.51.25r1093/driver/.libs/libmyodbc3-3.51.25.so (0xb7f31000)

    mysql@linux:/home/mysql$ ldd /usr/local/bin/isql
    linux-gate.so.1 => (0xb7f9e000)
    libodbc.so.1 => /usr/local/lib/libodbc.so.1 (0xb7f02000)
  2. Then relink the runtime by following these steps:
    1. In the "lib" subdirectory (of the directory in which you installed AcuSQL), edit the "config85.c" file and check that NO_ACUSQL has a value of "0" and is un-commented.

      #ifndef NO_ACUSQL
      define NO_ACUSQL 0
      #endif /* NO_ACUSQL */
    2. Ensure that lines 1 and 3 are commented.
      If they are not, an error like this may appear:
      In file included from sub.c:32:

      config85.c:133: error: expected â, â, â, âasmâ â__attribute__â before numeric constant
      make: *** ub.o] Error 1
    3. Then, open "Makefile" and set ACUSQL_ODBC_LIB to the library obtained with the "ldd" on "isql":

      ACUSQL_ODBC_LIB = /usr/local/lib/libodbc.so.1
    4. In the same file, be sure to have these lines commented/un-commented as follows:

      # Use the following two lines for an AcuSQL-DISABLED runtime:
      #ACUSQL_LIBS = # nothing - no acusql runtime libraries are necessary

      # Use the following two lines for an AcuSQL-ENABLED runtime:
    5. Save and close "Makefile."
  3. Then run the following commands:

    make clean
  4. Copy the relinked runcbl from LIB directory to BIN directory, and run your program to create /tmp/odbc.trace.

Incident Number: 2266010

Old KB# 14253
Comment List