PRB: Accessing SQL Database Fails on Second AttemptLast reviewed: December 9, 1997Article ID: Q166659 |
The information in this article applies to:
SYMPTOMSOne of the following error occurs when trying to access a SQL database via Active Server Pages (ASP):
Error '80004005' Microsoft OLE DB Provider for ODBC Drivers error '80040e21', Errors Occurred -or- 80004005: ConnectionWrite(GetOverLappedResult)The error occurs on the second access to the data. For example, using a form generated by the DataForm Wizard clicking on the ">>" button to view the next 10 records results in the error described above. This issue occurs when all of the following conditions are met:
CAUSEWhen the allow Anonymous User context is turned off, NT is closing the pipe to SQL Server after the first request is complete. This is because the first connection to SQL Server is made under the IIS Anonymous User account. IIS then either impersonates the browser client on that same thread, or tries to access the connection on a different thread that is running in the impersonated user context. In either case NT would detect the attempt to use a network named pipe handle that had been opened in a different user context and force the pipe closed, per its security rules. When the connections are viewed on the SQL Server with a network monitor, a name pipe close request comes from NT, causing the error in the Web browser.
RESOLUTIONThere are two relatively easy workarounds:
STATUSMicrosoft is researching this behavior and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATION
Steps to Reproduce Behavior
Following is the sample code:
<%@ LANGUAGE="VBSCRIPT" %> <HTML> <HEAD> <META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0"> <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1"> <TITLE>Document Title</TITLE> </HEAD> <BODY> <% If IsEmpty(Session("rsConn")) Then Set ISSQL65 = Server.CreateObject("ADODB.Connection") ISSQL65.Open "DRIVER={SQL Server}; SERVER=ISSQL65;UID=sa;PWD=; APP=Microsoft (R) Developer Studio;WSID=ISLAB11;DATABASE=ISCon", "sa" Set cmdTemp = Server.CreateObject("ADODB.Command") Set DataCommand1 = Server.CreateObject("ADODB.Recordset") cmdTemp.CommandText = "dbo.""Table1""" cmdTemp.CommandType = 2 Set cmdTemp.ActiveConnection = ISSQL65 DataCommand1.Open cmdTemp, , 1, 3 Else Set DataCommand1 = Session("rsConn") End If %> <% Response.Write DataCommand1.EOF & " " & DataCommand1.BOF & "<br>" DataCommand1.MoveNext%> <%= DataCommand1("Email") %><br> <%= DataCommand1("Fname") %><br> <%= DataCommand1("Lname") %><br> <% Set Session("rsConn") = DataCommand1 %> </BODY> </HTML> REFERENCESFor the latest Knowledge Base articles and other support information on Visual InterDev and Active Server Pages, see the following page on the Microsoft Technical Support site:
http://support.microsoft.com/support/vinterdev/ Keywords : VIASP VIServer Version : 1.0 Platform : WINDOWS Issue type : kbprb |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |