Microsoft Knowledge Base Email Alertz

(836072) - The ODBC trace does not work in a multithreaded Internet Information Services(IIS) environment.

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 836072 - Last Review: December 3, 2007 - Revision: 1.3

ODBC trace is unreliable in a multithreaded IIS environment

SYMPTOMS

If you try to trace an ODBC connection in a multithreaded Internet Information Services (IIS) environment, you may receive an empty log file, or a log file may not be created at all.

CAUSE

The multithreaded IIS environment does not support ODBC tracing.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to reproduce the behavior

  1. Create a Data Source Name (DSN). To do this, follow these steps:
    1. In Control Panel, click Administrative Tools, and then click Data Sources (ODBC). The ODBC Data Source Administrator dialog box appears.
    2. On the System DSN tab, click Add. The Create New Data Source dialog box appears.
    3. Double-click SQL Server in the Driver Name list. The Create a New Data Source to SQL Server dialog box appears.
    4. In the Name box, type mydatasource.

      Notemydatasource is a placeholder for the system DSN.
    5. In the Description box, type the description of the data source.
    6. In the Server box, type the server address or select the server that you want to connect to.
    7. Click Finish, and then click OK. The DSN appears in the ODBC Data Source Administrator dialog box.
    8. Click OK.
  2. Create an Active Server Pages (ASP) page. To do this, follow these steps:
    1. Create a folder on the desktop of your computer, and then name the folder MyWeb.
    2. Paste the following code in Notepad:
      <HTML>
      <HEAD><TITLE>ASP Database Connection</TITLE></HEAD>
      <BODY BGCOLOR=white>
      <H1>Northwind Database Contacts</H1>
      <%
      Dim Connect, selectSQL, RecSet 
      Set Connect = CreateObject ("ADODB.Connection")
      Connect.Open "DSN=<mydatasource>" 
      selectSQL = "SELECT * FROM Customers" 
      Set RecSet = Connect.Execute (selectSQL)
      If NOT RecSet.EOF THEN
      DO UNTIL RecSet.EOF
      Response.Write RecSet("Companyname") & ", " & RecSet("Contactname") & "<BR><BR>"
      RecSet.MoveNext
      Loop
      End If
      RecSet.Close
      Connect.Close
      Set RecSet = Nothing
      Set Connect = Nothing
      %>
      </BODY></HTML>
    3. Name this file myWeb.asp, and then save it in the MyWeb folder.
  3. Create a virtual directory. To do this, follow these steps:
    1. Click Start, and then click Run. The Run dialog box appears.
    2. In the Open box, type inetmgr, and then click OK. The Internet Information Services window appears.
    3. Double-click servername.

      Noteservername is a placeholder for the name of the server.
    4. Expand Web Sites under servername, right-click Default Web Site, point to New, and then click Virtual Directory.
    5. In the Virtual Directory Creation Wizard, click Next.
    6. In the Alias box, type foldername, and then click Next.

      Notefoldername is a placeholder for the virtual directory that you create on your computer that is running Internet Information Services.
    7. Click Browse, locate the MyWeb folder that you created on the desktop, and then click Next.
    8. Verify the access permissions, and then click Next.
    9. Click Finish to create the virtual directory.
  4. Trace the ODBC connection. To do this, follow these steps:
    1. In Control Panel, click Administrative Tools.
    2. Click Data Sources (ODBC), and then click the Tracing tab.
    3. In the Log file Path box, type C:\Sql.log to create a log file.

      NoteSql.log is a placeholder for the log file that the computer creates to log the results when you connect to the database through a program.
    4. Click Start Tracing Now and do not close the ODBC Data Source Administrator dialog box.
    5. Open the myWeb.asp file in Internet Explorer.
    6. After the page is loaded, click Stop Tracing Now in the ODBC Data Source Administrator dialog box.
    7. Open the Sql.log log file. You find the result that is mentioned in the "Symptoms" section.

APPLIES TO
  • Microsoft Open Database Connectivity Software Development Kit 2.5
  • Microsoft ODBC SDK
  • Microsoft Open Database Connectivity Software Development Kit 2.1
  • Microsoft Internet Information Services 6.0
  • Microsoft Internet Information Services version 5.1
  • Microsoft Internet Information Services 5.0
  • Microsoft Active Server Pages 4.0
Keywords: 
kbaspobj kbuser kbiisam kbprb KB836072
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate