Solved

Classic ASP page - DB connection Timeout issue

Posted on 2011-09-30
4
1,420 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
 

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
 

Author Closing Comment

by:nachtmsk
ID: 36893346
Thanks!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

738 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