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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL db time out errors in sql

Status
Not open for further replies.

aspnetuser

Technical User
Sep 9, 2004
273
US
I keep getting a lot of time out errors on this connection code that i use to sql server.

sub OpenDB()
Dim dbDir
Set dbConn = Server.CreateObject("ADODB.Connection")
DbConn.Open "Provider=SQLOLEDB; Data Source = ***.1111.111; Initial Catalog = ***; User Id = ***; Password = ****"
end sub

Is there any way I can increase the time out of this because some reports take a few minutes to run in my asp pasges and i need to up the time somehow.

ex:
code above
timeout expire (3 minutes)
 
try this instead, swapping the red bits for your info...
Code:
DbConn.Open("DRIVER={SQL Server};SERVER=[red]myServerName[/red];DATABASE=[red]myDBName[/red];UID=[red]myUserID[/red];pwd=[red]myPassword[/red];")

Tony
_______________________________________________________________
 
I may be on the wrong track here but I too was getting time out errors and was told by my provider that I couldn't increase this dynamically and that he would have to do it. But the kind guys at Tek-Tips gave me the following code.

server.timeout = however many seconds you want to set it to
e.g. server.timeout=600
which sets the timeout to 10 minutes

 
Fester no luck....

Scribbler,
I get the following.

Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'Server.timeout'

/common.asp, line 65


Dim dbDir
Set dbConn = Server.CreateObject("ADODB.Connection")
DbConn.Open("DRIVER={SQL Server};SERVER=****;DATABASE=****;UID=****;pwd=****;")
server.timeout=600
 
Sorry aspnetuser

I was trying to work from memory when I replied to you 1st time but this is the actual code I use....


Response.write "Time out was " & TimeOut & ("<br>")
Server.ScriptTimeout = 600
Response.write "Time out Set To " & TimeOut & ("<br>")
 
He is a piece of code that always use to work. Not it is referenced in the time out.

sql = "select count(*) as total" _
& " from Picks, Schedule" _
& " where Username = '" & username & "'" _
& " and Picks.GameID = Schedule.GameID" _
& " and Picks.Pick = Schedule.Result" _
& " and Picks.AutoPoolID = " & Session("AutoPoolID") & "" _
& " and Schedule.PoolType = '" & Session("PoolType") & "'" _
& " and Schedule.Result <> ''"
set rs = DbConn.Execute(sql)
if not (rs.BOF and rs.EOF) then
totalCorrect = rs.Fields("total").Value
end if

Microsoft OLE DB Provider for SQL Server error '80004005'

Timeout expired


DO you see anything wrong with the query or how i could design it differently. ( IT USE TO WORK FINE???)
 
No I don't see anything wrong but then again I'm quite new to this asp thing as well so don't take my word for it.

One thing though, I got the same problem and enede up using a value much higher than the 800 you mentioned. To get my code to run I ramped the timeout to 8000 as I was travelling thro' loads of records converting them from ASCii file to Access Database.
 
I get the time out message in less than 1 minute using 600 seconds...

has to be something else?
 
Only other thing I can think of is where abouts you are inserting the timeout code ? If you haven't already, make sure the code is at the top of the page but it's a sort of last ditch attempt.

I also found this link on the web for you which suggests "This is a problem with the SQL Server, contact your hosting company. "


Hope this helps as I'm out of ideas.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top