Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Posts
    6

    Question Unanswered: 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 12:41.

  2. #2
    Join Date
    Mar 2004
    Posts
    6
    Have you tried setting server.scriptTimeout?

    server.scriptTimeout = 1

  3. #3
    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.

  4. #4
    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.

  5. #5
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •