If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > cannot set connection timeout in ASP !

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-25-04, 11:02
torp torp is offline
Registered User
 
Join Date: Mar 2004
Posts: 6
Question cannot set connection timeout in ASP !

Hello,

In my ASP's I use an ADODB connection to an MS SQL Server 2000. For this specific ASP I need the connection timeout to be AS SHORT AS POSSIBLE so I set the timeout to 1:
Code:
       connectionDB.ConnectionTimeout = 1
Microsoft's explanation of ConnectionTimeout prop:
" The ConnectionTimeout property specifies the amount of time in seconds to wait for connection initialization to complete."

I thought this meant that the connection attempt would be canceled (and an error raised) .. after the time you specify in seconds...

Well nope .... I can set it to just about anything I want, the timeout only occurs after a minimum of 13 SECONDS !!! (which is way too long for my app in this perticular case).
Only exception: if I set the timeout to 0 it will wait forever (as documented).

What is wrong? Did I misunderstand the purpose of the Timeout prop? Does the software not do what it's supposed to? Am I missing something here?

Please, please tell me ... I really need to be able to find out FAST if the SQL server is available or not ! (assumed ConnectionTimeout was the way to do this)

Many, many thanx !!
Peter.

P.S. Perhaps I should mention that I display the ConnectionTimeout value in the page to verify it, and it's value IS indeed set to 1 ! Thx.

Last edited by torp; 03-25-04 at 11:41.
Reply With Quote
  #2 (permalink)  
Old 03-25-04, 14:19
hausbro hausbro is offline
Registered User
 
Join Date: Mar 2004
Posts: 6
Have you tried setting server.scriptTimeout?

server.scriptTimeout = 1
Reply With Quote
  #3 (permalink)  
Old 03-25-04, 14:47
torp torp is offline
Registered User
 
Join Date: Mar 2004
Posts: 6
Question

Hello hausbro,

no, haven't tried that because I want the ASP to continue after detecting that the SQL server is unavailable. Wouldn't this setting cause the ASP page to stop being processed after 1 sec?

Maybe it's an interesting way .. but then, how to arrange for a proper redirect AFTER the timeout has occurred ?

Maybe.. if I let an -included- script time out / set a session var if successful ... hmmmm... will try that in the morning !

Thanks! Pete.
Reply With Quote
  #4 (permalink)  
Old 03-26-04, 05:38
torp torp is offline
Registered User
 
Join Date: Mar 2004
Posts: 6
Question

NO - Doesn't work !!

Script times out and ends in a time-out error.
Even if the script is in another app, it still runs in the context of the script that called it - hence, ScriptTimeout applies for the whole app.
Somehow, this seems logical ....


Can anybody tell me why the Connection.Timeout thing isn't working ??
Any other suggestions, anybody ???

All help is welcome!

Muchos gracias;
Pete.
Reply With Quote
  #5 (permalink)  
Old 03-26-04, 11:42
torp torp is offline
Registered User
 
Join Date: Mar 2004
Posts: 6
Arrow

*TCP/IP*
Colleague told me that the 'minimum' delay of 13 secs comes from the lower TCP/IP layers which retry any connection at least 3 times. This can only be modified in registry (TCP/IP protocol parameters) and is of course server-wide (hence, will cause misery). So, no solution there for the connection.Timeout thing.

( Can anyone comment on this theory ?)


*MTS Transactions*
I discovered only one way out of this:
use the script time-out in a Transactional script so I can trap the time-out error and go from there.
Some workaround - but if it does the trick I'm happy ..


-> Further comments/tips/hints on this .. very welcome, please !

Thanks!
Pete.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On