Link to home
Start Free TrialLog in
Avatar of AutomaticSlim
AutomaticSlim

asked on

[Microsoft][ODBC SQL Server Driver]Timeout expired

When I run an online report sometimes I get the following error pointing to my ASP page
How can I stop this from happening....This happens when the user requests lots of data.
Is there any way to make the time unlimited?


Microsoft OLE DB Provider for ODBC Drivers (0x80040E31)
[Microsoft][ODBC SQL Server Driver]Timeout expired
Avatar of SRigney
SRigney
Flag of United States of America image

There is a connection timeout and a CommandTimeout property that both have default values of 60 seconds.  You probably need to modify the CommandTimeout to be longer.
Avatar of AutomaticSlim
AutomaticSlim

ASKER

How do I do this?
ASKER CERTIFIED SOLUTION
Avatar of apirnia
apirnia
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of David Todd
Hi,

I'd recommend _against_ making it unlimited.

Try timing it and then set the timeout to twice the longest time you get. The timeout is in there for a reason.

Alternatively, reconsider how much data you let the user select in any one report or batch.

Maybe both are needed.

Regards
  David
Yes true.... above is just a code for what you need to do....... use 0 just for testing.

In a simple description the reason the Timeout is there is because some end users don't have patience. They see that the report is taking a long time so they click on refresh again and again not knowing that it is has lots of data. This backs up the SQL server. and when you have it set to 0 it will run all the way. When you have Timeout it kills it if it is taking to long
Those solutions should help with the actual timeout problem.

I would suggest spending some time and looking at the underlying cause of the timeout problem. Look at the performance of your server, look at the amount of data being sent, look at the way in which the data is being rounded up. Are your queries the most efficient, is there a lot of activity on your server? How are your indexes arranged, is there another way to write your queries, etc. etc.

Increasing the timeout will just stop the timeout from happening after the default, but your users will still have to wait that much time for the report to generate, 60 seconds is a lifetime to some users out there ;)
My problem is even in sql environment i.e right click on table goto query and run some simpale qry like col03=so and so even then i am getting ODBC Driver time out for SQL
I don't know if you've solved this yet - but I just had the same problem on an Access XP form hitting a SQL 2000 box.  Only one table was timing out, and only on updates and inserts (the data displayed OK on the form)...

Update on linked table "tblCustomer" failed.  [ODBC SQL Server Driver] Timeout Expired (0)"

Recreating the table from scratch, a little bit at a time, uncovered the problem: three (3) ntext fields.  Changing these to nvarchar(4000) solved the problem.  Changing them back to ntext confirmed that this was indeed the issue.  

I had a similar issue but with a much smaller database.

In the end I had to copy the database to a new name and update my site accordingly. Apparently the table was somehow damaged. I had already tried compact and repair and it made no difference. This is probably not a guaranteed fix but using the answer above only caused the page to never load.