ODBC Troubleshooting: How to Enable Driver-manager Tracing

Enabling tracing at the driver-manager level is a useful way to troubleshoot ODBC driver issues. In this article, I’ll explain how to enable tracing for each of the driver managers to help in ODBC troubleshooting tasks.

You can choose from several driver managers, depending on the platform that you’re using.

Jump to unixODBC Driver Manager

Jump to iODBC Driver Manager (Mac OSX)

For information on enabling driver logging, see How do I enable logging in an ODBC driver?

Windows

This article does a nice job of explaining how to enable tracing, however, you can follow these simple steps if you don’t want the extra detail:

      1. Open the ODBC Administrator. See here for how to open the proper ODBC Administrator depending on driver bitness.
      2. Change to the Tracing tab.

odbc tracing

      1. Change the “Log File Path” field to be the location and name of the file to which you’d like to write the trace entries.
      2. Optional: Check the “Machine-wide tracing for all user identities” if you want the tracing to affect all users on the machine. This is useful if you want to trace things like SSIS which can run processes under separate users. If you are unsure, check this box.
      3. Hit the “Start Tracing Now” button. Tracing will become active only for applications started after tracing has started; currently-executing applications will not have tracing enabled. You must restart applications to have tracing enabled. You may need to restart services for applications which run separate processes such as SSIS, or you may have to restart the machine to properly enable tracing.
      4. Once you are done gathering a trace, disable tracing: Return to the Tracing tab in the ODBC Administrator and hit “Stop Tracing Now”, as tracing will consume disk space and significantly impact performance. Again, this will not affect currently-executing applications, only newly-started applications, so you may need to restart some applications.

 

Other Platforms – unixODBC

unixODBC is generally used on platforms other than Windows and OSX, although iODBC (see below) is sometimes also used. Here’s how to enable trace-logging:

      1. Locate your odbcinst.ini file. Generally this is located within your home directory, and it may be a hidden file.
      2. Under the section heading [ODBC] (add the heading if it does not exist) add the key-value pairs:
        • Trace=yes
        • TraceFile = /path/to/file/name.log

An example of what this would look like:

      1. You must restart applications after you add these entries before tracing will start. Once you are done gathering a trace, remember to disable tracing by changing the value of Trace to “no” in the odbcinst.ini file, as tracing will consume disk space and significantly impact performance. Again, this will not affect currently-executing applications, only newly-started applications, so you may need to restart some applications.

 

OSX and Other Platforms – iODBC

iODBC the default driver manager on OSX, and can sometimes be found on other non-Windows platforms. Enable trace logging by following the instructions below:

      1. Locate your odbc.ini file. Generally this is located within your home directory, and it may be a hidden file.
      2. Under the section heading [ODBC] (add the heading if it does not exist) add the key-value pairs:
        • Trace=1
        • TraceFile=/path/to/file/traceFile.log
        • Debug=1
        • DebugFile=/path/to/file/debugFile.log

An example of what this would look like:

    1. You must restart applications after you add these entries before tracing will start. Once you are done gathering a trace, remember to disable tracing by changing the value of Trace and Debug to “0” in the odbc.ini file, as tracing will consume disk space and significantly impact performance. Again, this will not affect currently-executing applications, only newly-started applications, so you may need to restart some applications.