Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Classic ASP page - DB connection Timeout issue

Posted on 2011-09-30
4
Medium Priority
?
1,676 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 2000 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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

730 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