Solved

Classic ASP page - DB connection Timeout issue

Posted on 2011-09-30
4
1,529 Views
Last Modified: 2012-06-22
Hi,
I am maintaining some old ASP code that I did not write. I am a programmer and a DB admin but I am not very familiar with ASP.
Here is the situation:
I have a web page that runs a query to SQL 2005. If the query returns 5 or 10 records it's fine. If it returns a large number, (1000), then I get the following error message on my browser:

----
Microsoft OLE DB Provider for ODBC Drivers error '80040e31'
[Microsoft][ODBC SQL Server Driver]Timeout expired
/utility/search_script.asp, line 201
-----
LINE 201 is below...

Set UserNames = Server.Createobject("ADODB.Recordset")
LINE 201 --> UserNames.Open sqlq, Connect  ,adopenstatic, adlockreadonly

If I run the same query in a SQL command line I get no problems returning the data.
So my question is:
Is the timeout issue an ASP script problem or an ODBC problem?
Suggestions please on how to fix this.  The entire script is about 400 lines long, which is why I didn't post the whole thing. But I can post additional pieces of it if need be.

Thanks!



0
Comment
Question by:nachtmsk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 31

Expert Comment

by:James Murrell
ID: 36892629
you try something like
<%
    Server.ScriptTimeout = 180
%>

in asp code
0
 
LVL 29

Accepted Solution

by:
Paul Jackson earned 500 total points
ID: 36892709
The error you are getting is a sql command timeout.
By default the command timeout is 30 secs if your query is going to take longer than 30 seconds you will need to increase it by setting the CommandTimeOut property of your command object.
Something like :

myCommand.CommandTimeout = 60

See for further info : http://vyaskn.tripod.com/watch_your_timeouts.htm

If you want further help post some of the code above line 201 where the command and connection objects are created.

0
 
LVL 1

Author Comment

by:nachtmsk
ID: 36893345
Thanks for the comments.
In my case, Jacko72's answer was correct. I looked at the sql statement that was being passed. It was different then I thought it was. It was joining on 4 tables. Anyway, the SQL is what was timing out. Thanks!
M
0
 
LVL 1

Author Closing Comment

by:nachtmsk
ID: 36893346
Thanks!
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question