ODBC Subkey

The values under the ODBC subkey specify ODBC tracing options. These options are set through the Tracing tab of the ODBC Data Source Administrator dialog box displayed by SQLManageDataSources. The ODBC subkey itself is optional. The format of these values is:

Name Data type Data
Trace REG_SZ 0 | 1
TraceAutoStop REG_SZ 0 | 1
TraceFile REG_SZ tracefile-path

where the values have the following meanings:

Value Meaning
Trace If the Trace value is set to 1 when an application calls SQLAllocHandle with the SQL_HANDLE_ENV option, then tracing is enabled for the calling application.

If the Trace keyword is set to 0 when an application calls SQLAllocHandle with the SQL_HANDLE_ENV option, then tracing is disabled for the calling application. This is the default value.

An application can enable or disable tracing with the SQL_ATTR_TRACE connection attribute. However, doing so does not change the data for this value.

TraceFile If tracing is enabled, the Driver Manager writes to the trace file specified by the TraceFile value.

If no trace file is specified, the Driver Manager writes to the \SQL.LOG file on the current drive. This is the default value.

Tracing should only be used for a single application or each application should specify a different trace file. Otherwise, two or more applications will attempt to open the same trace file at the same time, causing an error.

An application can specify a new trace file with the SQL_ATTR_TRACEFILE connection attribute. However, doing so does not change the data for this value.

TraceAutoStop If the TraceAutoStop value is set to 1 when an application calls SQLFreeHandle with the SQL_HANDLE_ENV option, then tracing is disabled for all applications and the Trace value is set to 0. This is the default value.

If the TraceAutoStop value is set to 0, then tracing must be disabled through the Tracing tab of the ODBC Data Source Administrator dialog box displayed by the SQLManageDataSources function.


For example, suppose that tracing is enabled, the trace file is C:\ODBC.LOG, and that tracing is to stop automatically. The values under the ODBC subkey would be:

Trace : REG_SZ : 1
TraceAutoStop : REG_SZ : 1
TraceFile : REG_SZ : C:\ODBC.LOG