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

Connectiontimeout problem 1

Status
Not open for further replies.

soapdad

Technical User
Oct 22, 2003
9
US
I am running a query to a remote MSSQL server off of my default page. Most of the time it works great, unless that server is down. In this case, it takes a very long time to load the page. I am trying to use connectiontimeout or commandtimeout to limit the amount of time we waste if the connection cannot be made but I cannot get them to make any difference in the timing. Does anyone have any suggestions? The code is below....
Thanks
-------------------------------------------
Set connection1 = Server.CreateObject("ADODB.Connection")
varServerIP = "999.999.999.999"
varUserName = "myname"
varPassword = "mypass"
varDataBaseName = "mydb"
connection1.ConnectionTimeout= 5
connection1.CommandTimeout= 5
connection1.Open "DRIVER={SQL Server}; Server=" & varServerIP & "; Database=" & varDataBaseName & "; UID=" & varUserName & "; PWD=" & varPassword
-----------------------------------------------
 
I've played with that problem before. The kludge solution that I came up with was to have a program that ran in the background to monitor the connection. When the server was down it would delete a local file. When it was re-activated it would recreate the dummy file. The application program could at any time check for the existence of that file to determine if a connection would succeed. I found no way to include the logic within the application itself without creating that delay. Maybe with .NET there is a better way. I'm not presently using the application and haven't heard of a better way to eliminate that pregnant pause.
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top