From: Alex Clark on
Hi all,

I'm testing some of the fail-over code in my app, and I wanted to test the
code that handles an unavailable database server.

So naturally I shutdown my SQL server and waited for the connection attempt
to time-out. And waited. And waited.

I realised that the "Connect Timeout" param in my connection string was set
to 30, and the MSDN website says this is measured in seconds. I wanted it
to fail a little sooner than that so I dropped it down to 5s. And waited.
And waited some more.

It seems that no matter how low I set this parameter, it still waits for 15s
at a minimum. This is highly frustrating, particularly as this app will
most often run on the same machine as the SQL server itself, so if it
doesn't connect in the first 5s it likely won't connect at all. I don't
want my users to have to wait so long before they're told they forgot to
fire up the SQL service.

I tried this in Release mode too, but it had no effect.

OS is XP Pro x64, SQL 2008, VS 2008 SP1, .NET 3.5 SP1, using
System.Data.SqlClient.

Anybody know why it doesn't respect the "connect timeout=N" param in the
connection string? I've even checked the .ConnectionTimeout property of the
SqlConnection object I create, and that *does* pick up what I've set it to
in the con-string (i.e. it's showing 5 right now). But it still waits for
15s!

Any ideas, anyone?

TIA,
-Alex