Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timeout expired

Status
Not open for further replies.

Kendel

Programmer
Apr 24, 2002
1,512
US
Hello,

I have this error on a query.

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC SQL Server Driver]Timeout expired

/school/class-detailed.asp, line 13

Is this 'Timeout expired' set on the WebServer or SQLServer? How can I reset it?

Thanks.
 
yes, you can reset the timeout on the server but before you consider doing that, check your code and see if you have an error in the code.

one thing in particular that I would look for is a loop where you didn't specify to move to the next record (I did that one a lot when I started learning this stuff!).

this sets the timeout:

Session.Timeout = 10

Note: Session timeout is in minutes.

hth
mb

"Where's the Ka-Boom? There's supposed to be an Earth-shattering Ka-Boom!"
Marvin the Martian
 
Thanks hithere. I don't think the code has a problem because sometime it goes through sometimes it timeout.

Where can I find the session.timeout? Is it in the code, in WebServer, or SQLServer?

Thanks.
 
it's a server setting so whomever sets up and maintains the server your working with would set that. i'm not sure where it actually is set. doing a quick google I came up with this link that you may find helpful.

hth
mb

"Where's the Ka-Boom? There's supposed to be an Earth-shattering Ka-Boom!"
Marvin the Martian
 
I still don't get it. That link saying that if I have this:
Server.ScriptTimeout = 1800, it will overwrite the ScripTime on my Server. But I still get the Timeout Expired Error.

Anyone????
 
post your code so we can take a look. we might be able to see something and help ya' that way.

"Where's the Ka-Boom? There's supposed to be an Earth-shattering Ka-Boom!"
Marvin the Martian
 
Set Conn=Server.CreateObject("ADODB.Connection")
Conn1.Open "DSN=sql.mySQL.com;UID=sa;PWD=9966;DATABASE=DB9"
Server.ScriptTimeout = 600

Set RS=Server.CreateObject("ADODB.RecordSet")
strSQL = "SELECT cust_id, SUM(" & myVar& ") AS myTest " & _
" FROM cust_table " & _
" WHERE cust_id = " & my_id & " " & _
" AND the_date = '" & myDate & "' " & _
" GROUP BY tran_id "

RS.Open strSQL, Conn
 
RS.Open strSQL, Conn

need the 1 at the end of Conn becasue you opened it as:
Conn1.Open "DSN=sql.....

that may not be the only problem but it's the first thing I saw.

"Where's the Ka-Boom? There's supposed to be an Earth-shattering Ka-Boom!"
Marvin the Martian
 
That's a typo. There is no 1 in my code. Thanks.
 
My question is why doesn't Server.ScripTimeout work. If less than 500 records return, then I have no problem at all. That mean the problem is not at my select statement.

...arhhh
 
this is going to sound silly but....move that script time out to the top of the page (if this select statement's not already close to the top) and see if that works. from the reading I'm doing, I keep seeing it repeated that it needs to be at the top. (sorry, I forgot that bit. not something I use very often).

"Where's the Ka-Boom? There's supposed to be an Earth-shattering Ka-Boom!"
Marvin the Martian
 
still... no luck :(

Thanks so much for being so patient with me hithere!!!
 
no problem. ummm...running out of ideas here. Just to be sure (okay, and basic), you've verified that all the data is correct? nothing in there that would be nonsense to the sql statement and cause it to hang? i.e. a cust_id entered incorrectly etc, etc.

one other thought almost completely not related. is there a reason you're using a dsn connection instead of a dsn-less? my understanding is that dsn-less is faster. might want to consider switching to that type, may help here as well. there's some good stuff about connections on probably in the faq's here as well.
mb

"Where's the Ka-Boom? There's supposed to be an Earth-shattering Ka-Boom!"
Marvin the Martian
 
This worked for me when I was having the same problem. Add the "Conn.CommandTimeout = seconds" line after you create the connection:

Conn.Open "DSN=sql.mySQL.com;UID=sa......
Conn.CommandTimeout = 60

The 60 stands for seconds. You might need more time for longer queries. Good Luck.
--Tim



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top