1 Diagnostic Tools : ODBC Trace

ODBC Trace
ODBC tracing allows you to trace calls to ODBC drivers and create a log of the traces. Creating a trace log is particularly useful when you are troubleshooting an issue.
To create a trace log:
1
2
3
4
For a complete explanation of tracing, refer to the following Progress DataDirect Knowledgebase document:
http://progresscustomersupport-survey.force.com/ConnectKB/articles/Article/3049?retURL=%2Fapex%2FKnowledgeSearch&popup=false
Enabling Tracing
Progress DataDirect provides a tracing library that is enhanced to operate more efficiently, especially in production environments, where log files can rapidly grow in size. The DataDirect tracing library allows you to control the size and number of log files.
On Windows, you can enable tracing through the Tracing tab of the ODBC Data Source Administrator.
On UNIX and Linux, you can enable tracing by directly modifying the [ODBC] section in the system information (odbc.ini) file. On Linux, you can also enable tracing through the Trace tab of the DataDirect ODBC Data Source Administrator for Linux.
Windows ODBC Administrator
the ODBC Data Source Administrator and the Tracing tab. To specify the path and name of the trace log file, type the path and name in the Log File Path field or click Browse to select a log file. If no location is specified, the trace log resides in the working directory of the application you are using.
Click Select DLL in the Custom Trace DLL pane to select the DataDirect enhanced tracing library, xxtrcyy.dll, where xx represents either iv (32-bit version) or dd (64-bit version), and yy represents the driver level number, for example, ivtrc26.dll. The library is installed in the \Windows\System32 directory.
After making changes on the Tracing tab, click Apply for them to take effect.
Enable tracing by clicking Start Tracing Now. Tracing continues until you disable it by clicking Stop Tracing Now. Be sure to turn off tracing when you are finished reproducing the issue because tracing decreases the performance of your ODBC application.
When tracing is enabled, information is written to the following trace log files:
Trace log file (trace_filename.log) in the specified directory.
Trace information log file (trace_filenameINFO.log). This file is created in the same directory as the trace log file and logs the following SQLGetInfo information:
The DataDirect enhanced tracing library allows you to control the size and number of log files. The file size limit of the log file (in KB) is specified by the Windows Registry key ODBCTraceMaxFileSize. Once the size limit is reached, a new log file is created and logging continues in the new file until it reaches its file size limit, after which another log file is created, and so on.
The maximum number of files that can be created is specified by the Registry key ODBCTraceMaxNumFiles. Once the maximum number of log files is created, tracing reopens the first file in the sequence, deletes the content, and continues logging in that file until the file size limit is reached, after which it repeats the process with the next file in the sequence. Subsequent files are named by appending sequential numbers, starting at 1 and incrementing by 1, to the end of the original file name, for example, SQL1.LOG, SQL2.LOG, and so on.
The default values of ODBCTraceMaxFileSize and ODBCTraceMaxNumFiles are 102400 KB and 10, respectively. To change these values, add or modify the keys in the following Windows Registry section:
[HKEY_CURRENT_USER\SOFTWARE\ODBC\ODBC.INI\ODBC]
WARNING: Do not edit the Registry unless you are an experienced user. Consult your system administrator if you have not edited the Registry before.
Edit each key using your values and close the Registry.
Linux ODBC Administrator
On Linux, you can enable tracing either through the Trace tab of the DataDirect ODBC Data Source Administrator for Linux (the Linux ODBC Administrator) or by directly modifying the [ODBC] section in the system information (odbc.ini) file.
To specify the path and name of the trace log file, type the path and name in the Trace File field or click Browse to select a log file. If no location is specified, the trace log resides in the working directory of the application you are using.
DataDirect ships an enhanced library to perform tracing. This library appears by default in the Trace Library field. If you want to use a custom library instead, type the path and name of the library in the Trace Library field or click Browse to select a library.
To enable tracing, select the Enable Tracing check box on the Trace tab of the Administrator. Clear the check box to disable tracing. Tracing continues until you disable it. Be sure to turn off tracing when you are finished reproducing the issue because tracing decreases the performance of your ODBC application.
After making changes on the Trace tab, click Apply for them to take effect.
The DataDirect enhanced tracing library gives you more control over tracing. See “System Information (odbc.ini) File” for a complete discussion of how to configure enhanced tracing.
System Information (odbc.ini) File
The [ODBC] section of the system information file includes several keywords that control tracing:
Trace=[0 | 1]
TraceFile=trace_filename
TraceDll=ODBCHOME/lib/xxtrcyy.zz
ODBCTraceMaxFileSize=file_size
ODBCTraceMaxNumFiles=file_number
TraceOptions=0
Where:
Trace=[0 | 1]—Allows you to enable tracing by setting the value of Trace to 1. Disable tracing by setting the value to 0 (the default). Tracing continues until you disable it. Be sure to turn off tracing when you are finished reproducing the issue because tracing decreases the performance of your ODBC application.
TraceFile=trace_filename—Specifies the path and name of the trace log file. If no path is specified, the trace log resides in the working directory of the application you are using.
TraceDll=ODBCHOME/lib/xxtrcyy.zz —Specifies the library to use for tracing. The driver installation includes a DataDirect enhanced library to perform tracing, xxtrcyy.zz, where xx represents either iv (32-bit version) or dd (64-bit version), yy represents the driver level number, and zz represents either so or sl. For example, ivtrc26.so is the 32-bit version of the library. To use a custom shared library instead, enter the path and name of the library as the value for the TraceDll keyword.
The DataDirect enhanced tracing library allows you to control the size and number of log files with the ODBCTraceMaxFileSize and ODBCTraceMaxNumFiles keywords.
ODBCTraceMaxFileSize=file_size. The ODBCTraceMaxFileSize keyword specifies the file size limit (in KB) of the log file. Once this file size limit is reached, a new log file is created and logging continues in the new file until it reaches the file size limit, after which another log file is created, and so on. The default is 102400.
ODBCTraceMaxNumFiles=file_number. The ODBCTraceMaxNumFiles keyword specifies the maximum number of log files that can be created. The default is 10. Once the maximum number of log files is created, tracing reopens the first file in the sequence, deletes the content, and continues logging in that file until the file size limit is reached, after which it repeats the process with the next file in the sequence. Subsequent files are named by appending sequential numbers, starting at 1 and incrementing by 1, to the end of the original file name, for example, odbctrace1.out, odbctrace2.out, and so on.
TraceOptions=[0 | 1 |2 | 3]. The ODBCTraceMaxNumFiles keyword specifies whether to print the current timestamp, parent process id, process id, and thread id for all ODBC functions to the output file. The default is 0.
If set to 3, both TraceOptions=1 and TraceOptions=2 are enabled. The header includes a timestamp as well as a parent process ID and process ID.
Example
In the following example of trace settings, tracing has been enabled, the name of the log file is odbctrace.out, the library for tracing is ivtrc26.so, the maximum size of the log file is 51200 KB, and the maximum number of log files is 8. Timestamp and other information is included in odbctrace.out.
Trace=1
TraceFile=ODBCHOME/lib/odbctrace.out
TraceDll=ODBCHOME/lib/ivtrc26.so
ODBCTraceMaxFileSize=51200
ODBCTraceMaxNumFiles=8
TraceOptions=3