Timeout property

  • with both ADO and SQLDMO I find that setting the timeout property while connecting doesn't do too much. Regardless of what it set timeout to in sqldmo it will wait up to 75 seconds to tell me a server does not exists. i have tried logintimeout=1

    is there anyway I can manipulate this to make it shorter (so user's don't have to wait so long to see this result) or longer so it can wait for a remote server to connect like in the case of web based sql server?

    what am i doing wrong with logintimeout property?

    Brian Lockwood

    President

    LockwoodTech Software

    Brian Lockwood
    President
    ApexSQL - SQL Developer Essentials

    http://www.apexsql.com/blog

    Stand up for an Independent SQL Community - be Informed

  • Never needed it much so far! I ran this as a test:

    Dim oserver As SQLDMO.SQLServer

    Dim sngStart As Single

    On Error GoTo Handler

    Set oserver = New SQLDMO.SQLServer

    With oserver

    .LoginSecure = True

    .LoginTimeout = 2

    sngStart = Timer

    .Connect "eg\two"

    Debug.Print "Elapsed: "; Timer - sngStart

    End With

    oserver.DisConnect

    Set oserver = Nothing

    Exit Sub

    Handler:

    Resume Next

    Ran it three times with a 5 sec delay, got these times:

    Elapsed: 8.554688

    Elapsed: 8.484375

    Elapsed: 8.542969

    Changing to 2 second delay:

    Elapsed: 4.183594

    Elapsed: 4.226563

    Elapsed: 4.175781

    All of these with a local instance stopped. Looks like 2-2.5 seconds of overhead between the object itself and maybe the error handler. Nothing close to 75 seconds. Possibly because it's local, but you wouldnt think it would matter.

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

  • thx - i tried it and here's what i get ...

    Elapsed: 85.1875

    Elapsed: 85.1875

    Elapsed: 89.57813

    running your code. i'm hitting a sql2k server on local machine.

    just to be clear this is a bogus connection string you are using right? the goal is to attempt to connect then quit if it doesn't connect in x seconds.

    Brian Lockwood

    President

    LockwoodTech Software

    Brian Lockwood
    President
    ApexSQL - SQL Developer Essentials

    http://www.apexsql.com/blog

    Stand up for an Independent SQL Community - be Informed

  • Its a server that has the service stopped. Could some people try the test code I posted earlier?

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply