Microsoft KB Archive/274551

From BetaArchive Wiki
Knowledge Base


Article ID: 274551

Article Last Modified on 7/1/2004



APPLIES TO

  • Microsoft Data Access Components 1.5
  • Microsoft Data Access Components 2.0
  • Microsoft Data Access Components 2.1
  • Microsoft Data Access Components 2.5
  • Microsoft Data Access Components 2.6
  • Microsoft Data Access Components 2.7



This article was previously published under Q274551

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.

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:

    Value Description
    Trace If this flag is 1, then tracing is ON. If the value is 0, then tracing is OFF.
    TraceDll Specifies the trace DLL that performs tracing.
    TraceFile Shows 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:

    Value Description
    Trace If this flag is 1, then tracing is ON. If the value is 0, then tracing is OFF.
    TraceDll Specifies the trace DLL that performs tracing.
    TraceFile Shows 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.


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


Keywords: kbhowto KB274551