Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-07-12 : 09:05:15
|
| Muhammad Ali writes "hi!i get error when i access sql server from asp [Microsoft][ODBC SQL Server Driver]Timeout expiredhow can i resolve this problem but i have chenged the sql server query timeout set to 0means unlimited query time out" |
|
|
nizmaylo
Constraint Violating Yak Guru
258 Posts |
Posted - 2002-07-12 : 14:52:20
|
| Could you pls post more details regarding you ASP script? It might be your ASP script, which times out, not the SQL Server.helena |
 |
|
|
msrviking
Starting Member
7 Posts |
Posted - 2002-07-13 : 07:00:07
|
| Hi,Sorry to disagree Helena. The OLE DB Provider Error as posted in the msg is Time Out Expired is of Sql Server. Ali, Kindly check up the queries being used by you.. try optimising the query like use joins instead of sub-query, index your tables appropriately, use stored procedures for retrieving data from back-end (Sql Server).Viking. |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-07-13 : 08:22:17
|
quote: Sorry to disagree Helena. The OLE DB Provider Error as posted in the msg is Time Out Expired is of Sql Server
...which is being accessed from an ASP script, and is taking so long to process the information that the connection to SQL Server exceeds its timeout limit.In all likelihood this is due to a recordset being processed in a loop, similar to this:While not rsObj.EOF response.write rs("someColumn") response.write someOtherStuff rsObj.MoveNext 'hey, what if this line were missing? hmmmm?WendI will bet a case of your favorite beer that that's what's causing the timeout problems. Which can be corrected by changing the timeout setting for the ASP SCRIPT (hey, that sounds familiar! Does that sound familiar to you Helena? :)Server.ScriptTimeout=60 'or increase this number if 60 seconds isn't long enoughThe best way to alleviate this problem is to not use a loop through a recordset. Instead, use the GetRows method to dump the data into an array and then process the array. This will minimize the time the ASP page is connected to SQL Server. You can also use GetString. There are a number of links with code snippets:http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=14388http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=10176http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=11833http://www.learnasp.com/learn/whygetrows.aspThese sites have more info on using GetRows and GetString:www.4guysfromrolla.comwww.learnasp.comwww.asp101.comwww.15seconds.com |
 |
|
|
VyasKN
SQL Server MVP & SQLTeam MVY
313 Posts |
Posted - 2002-07-13 : 10:59:29
|
| >> Server.ScriptTimeout=60 Rob, if its a script timeout, you'd see a script timeout error, not ODBC timeout error! Or am I missing something.Ali, I listed some troubleshooting steps at: http://vyaskn.tripod.com/sql_odbc_timeout_expired.htm--HTH,Vyashttp://vyaskn.tripod.com |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-07-13 : 11:34:09
|
Yes, that's true. Hmmmm. I think I should have said to increase the CommandTimeout property on the connection object:connObj.CommandTimeout=60I keep getting the two mixed up. But usually if you change one of those settings you also have to change the other; that's been my experience anyway. Because if the connection is open for 60 seconds before timing out, the script timeout will occur, and vice versa. |
 |
|
|
VyasKN
SQL Server MVP & SQLTeam MVY
313 Posts |
Posted - 2002-07-13 : 14:23:14
|
Yeah, too many types of timeouts Connection TimeoutCommand TimeoutScript TimeoutQuery TimeoutLogin Timeout --HTH,Vyashttp://vyaskn.tripod.com |
 |
|
|
|
|
|
|
|