开发者

An Erroneous SQL Query makes browser hang until script timeout exceeded

I have an admin page in a Classic ASP web application that allows the admin user to run queries against the database (SQL Server 2000)

Whats really strange is that if the query you send has an error in it (an invalid table join, a column you've forgotten to group by etc) the BROWSER hangs (CPU usage goes to maximum) until the SERVER script timeout is exceeded and then spits out a timeout exceeded error (server and browser are on different machines, so not sure how this happens!) I have tried this in IE 8 and FF 3 with the same result.

If you run that same query (with errors) directly from SQL Enterprise Manager, it returns the real error immediately. Is this a security feature? Does anyone know how to turn it off? It even happens when the connection to the database is using 'sa' credentials so I dont think its a security setting :(

Dim oRS 
Set oRS = Server.CreateObject("ADODB.Recordset") 
oRS.ActiveConnection = sConnectionString 

// run the query - this is for the admin only so doesnt check for sql safe commands etc. 
oRS.Open Request.Form("txtSQL") 

If Not oRS.EOF Then 
    // list the field names from the recordset 
    For i = 0 to oRS.Fields.Count - 1 
        Response.Writ开发者_JS百科e oRS.Fields(i).name & " " 
    Next 
    // show the data for each record in the recordset 
    While Not oRS.EOF 
        For i = 0 to oRS.Fields.Count - 1 
       Response.Write oRS.Fields(i).value & " " 
        Next 
        Response.Write "<br />" 
        oRS.Movenext() 
    Wend 
End If 


Try taking the core contents of the ASP (the bit that does the work) and stick it into a pure VBS script and run that from a cmd prompt via cscript (i.e., cscript bit_wot_does_stuff.vbs) and see how quickly that comes back. [Change Server.CreateObject to CreateObject and any Response.Write to WScript.Echo for it to work in a cmd environment].

Hopefully this will tell you whether the problem lies either in ASP/IIS or within some oddity with the ADO libs (although the code looks okay, but I haven't executed it :-) ).

Hopefully it'll give you something to then trace a bit further.


SOLUTION (Just to close the post coz it aint gonna get solved!)

Upgrade to SQL Server 2005/2008/R2 - solved the problem :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜