Solved

Classic ASP page - DB connection Timeout issue

Posted on 2011-09-30
4
1,111 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
  • 2
4 Comments
 
LVL 31

Expert Comment

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

in asp code
0
 
LVL 29

Accepted Solution

by:
Paul Jackson earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks!
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now