Enabling Tracing
Tracing can be enabled in the following three ways:
Set the Trace and TraceFile keywords in the Odbc.ini registry entry. This enables or disables tracing when SQLAllocHandle with a HandleType of SQL_HANDLE_ENV is called. These options are set in the Tracing tab of the ODBC Data Source Administrator dialog box displayed during data source setup. For more information, see Registry Entries for Data Sources.
Call SQLSetConnectAttr to set the SQL_ATTR_TRACE connection attribute to SQL_OPT_TRACE_ON. This enables or disables tracing for the duration of the connection. For more information, see the SQLSetConnectAttr function description.
Use ODBCSharedTraceFlag to turn tracing on or off dynamically. (For more information, see the next topic, Dynamic Tracing.)