To turn on unixODBC tracing, add the following section to odbcinst.ini
. To locate odbcinst.ini
, type odbcinst -j
. (If you're using the version of unixODBC that's included in an Easysoft ODBC driver distribution, by default, odbcinst
is in the /usr/local/easysoft/unixODBC/bin
directory.) Note that the permissions on odbcinst.ini
may make it necessary for you to be the root user to make changes.
# To enable unixODBC tracing, add this section to odbcinst.ini
.
# Include the [ODBC] section heading.
[ODBC]
Trace = yes
TraceFile = trace_file_path
where trace_file_path
is the path of the file you want log entries to be written to. For example, /tmp/sql.log
. If the file doesn't exist, the Driver Manager creates it.
Note that running ODBC applications as different users may affect tracing. This is because most users set their umask
in a way that prevents other users from writing to newly created files. For example, user A enables tracing and connects to the Driver Manager, creating a new trace file. When user B uses the Driver Manager, it's likely nothing will be traced because user B does not have write permission to the trace file.
As tracing will slow your application down, remember to turn tracing off when you have finished debugging. To do this, either remove the previous lines from your odbcinst.ini
file or make the following change:
Trace = no
For information about the format of trace file entries, refer to the ODBC on Linux and UNIX platforms article.