Tracing
Enable
To trace your application behavior, first add the following line to the odbcinst.ini file:
; trace = off
[ODBC]
Trace=yes
TraceFile=/tmp/odbctrace.out
; Others
DisableGetFunctions = 1
Debug=/tmp/odbc.log
Format
The general form is:
[ODBC][Process ID][C source containing the ODBC API][source line number]
Entry:
argument 1 = value
argument 2 = value
argument n = value
[ODBC][Process ID][C source containing the ODBC API][source line number]
Exit: [ODBC status]
output argument 1 = value
output argument 2 = value
output argument n = value
strace
Then you start the trace with strace. For example:
# locate in /usr/bin/strace
strace -t -f -o trace_out.txt executableToTrace
Example with isql
strace -t -f -o trace_out.txt isql -v <DSN>< USERNAME> <PASSWORD>
Output:
- ENOENT: No such file or directory
- Open file call
If the process crashs and that you want to see the restart, add strace to a while loop:
while [ 1 -eq 1 ]; do strace -f -p $(pgrep nqsserver) -tt -y -s 4096 -o ~/nqs_trace_$(date +%Y%m%dT%H%M%S%N).out;done