Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

How To Generate an ODBC Trace with ODBC Data Source Administrator


View products that this article applies to.

Summary

The ODBC Driver Manager has a trace facility that allows the sequence of function calls made by an ODBC application to be recorded into a log file. Tracing is performed by a trace DLL, which captures calls between the application and the Driver Manager, and between the Driver Manager and the driver. This article describes how to start and stop ODBC tracing.

↑ Back to the top


More information

  • Steps to Generate an ODBC Trace for ODBC Applications That Are Running Under the System Account

    1. Open the ODBC Data Source Administrator tool.
      • On a Microsoft Windows NT 4.0 computer, this is available in Control Panel as the Data Sources (ODBC) icon.
      • On a Microsoft Windows 2000 computer, this is available as the Data Sources (ODBC) icon in Control Panel under Administrative Tools.
    2. Click the System DSN tab, and then click Tracing.
    3. Click Start Tracing Now to enable tracing. Now, this button will read Stop Tracing Now.
    4. You can specify the name of the log file in the Log File Path text box along with the full path (for example, C:\Odbclogs\Odbclog1.log).
    5. Click OK.
    This information is recorded in the following registry key:
    HKEY_LOCAL_MACHINE\Software\ODBC\ODBC.ini\ODBC
    The following table shows the entries under this key, which control the tracing process:

    ValueDescription
    TraceIf this flag is 1, then tracing is ON. If the value is 0, then tracing is OFF.
    TraceDllSpecifies the trace DLL that performs tracing.
    TraceFileShows the full path of the file to which the ODBC calls are written.


  • Steps to Generate an ODBC Trace for ODBC Applications That Are Running Under the Current User Account

    1. Open the ODBC Data Source Administrator tool.
    2. Click either the User DSN tab or File DSN tab, and then click Tracing.
    3. Click Start Tracing Now to enable tracing. Now, this button reads Stop Tracing Now.
    4. You can specify the name of the log file in the Log File Path text box along with the full path.
    5. Click OK.
    This information is recorded in the following registry key:
    HKEY_CURRENT_USER\Software\ODBC\ODBC.ini\ODBC
    The following table shows the entries under this key, which control the tracing process:

    ValueDescription
    TraceIf this flag is 1, then tracing is ON. If the value is 0, then tracing is OFF.
    TraceDllSpecifies the trace DLL that performs tracing.
    TraceFileShows the full path of the file to which the ODBC calls are written.
To stop tracing, follow either of the previous procedures, depending on the type of application, except this time you must click Stop Tracing Now, which would then read Start Tracing Now.

NOTES

  • If tracing does not appear to be working (that is, no trace file is generated or an empty file is created), you can turn it on by editing the registry directly. To make sure tracing is turned on, locate both of the registry locations listed previously, set Trace to 1, and set TraceDll and TraceFile to appropriate values. This action forces tracing to be on for all applications, regardless of whether they are running under the system account or the current user account.
  • Always specify a full path like "C:\Sql.log" (without the quotes) in the Log File Path option.
  • The Apply button is activated when you change the Log File Path. Either click OK or click Apply so that the changes take effect.
  • Do not forget to turn tracing off when you are done with the troubleshooting. If you keep tracing set to on, it degrades your application performance.
  • If you are using Microsoft ActiveX Data Objects (ADO), you may not be able to get any ODBC tracing. This occurs because ADO is an OLEDB Consumer and it uses OLEDB instead of ODBC. You do have ODBC tracing with ADO, but only if you are using the Microsoft OLEDB Provider for ODBC Driver (MSDASQL) Provider.

↑ Back to the top


References

For additional information about ODBC Tracing, click the article numbers below to view the articles in the Microsoft Knowledge Base:
166458 'One-time Only' Tracing Option Does Not Stop Automatically
268591 ODBC Tracing to SQL.LOG Can Slow SQL or Consume All Space
139655 Tracing SQL Generated by MS SQL Server ODBC Driver
168879 Driver Manager Trace Facility Logs User Names and Password

↑ Back to the top


Keywords: KB274551, kbhowto

↑ Back to the top

Article Info
Article ID : 274551
Revision : 4
Created on : 7/1/2004
Published on : 7/1/2004
Exists online : False
Views : 295