Connection Timeout

  • Thread starter Thread starter A.M
  • Start date Start date
A

A.M

Hi,

Can I define connection's timeout in SqlConnection's connection string ?

Thanks,
Alan
 
You mean besides using the ConnectionString "Connection timeout=xx;" option?

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
server=myServer;uid=myUser;pwd=myPassword;database=myDatabase;Connect
Timeout=60


Connect Timeout=60
 
Be aware that the Connection Timeout value is "at least" x instead of "at
most" x seconds. We will not automatically abort the connection attempt when
the timeout is reached. Think of a loop:

Try to connect loop:
If time is greater than Connection Timeout exit.
call win32 api; //this can take some time.
End try to connect loop.

In this scenario your worst case connection timeout will be Connection
Timeout -1 + time it takes to do win32 api call. In some cases, like a
server that is down this can add up to a significant chunk of time.

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging about ADO.NET: http://weblogs.asp.net/angelsb/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top