Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Connexion Timeout (ADO) does not work as expected

Author  Topic 

olibara
Yak Posting Veteran

94 Posts

Posted - 2015-04-19 : 06:46:47
Hello

I'm testing a Mobile Application (Windows CE)
The application is sending information on a SQL server 2008 Database
But in case of connexion failure I switch to Off-Line mode

To do that I'm detecting the ADO exception when connecting to DB
But I need to reduce the attempt time by using the Connexion Timeout parameter in the connexion string

But it does not work as expected

When NO connexion TimeOut is specified, it takes +/- 20 seconds before to get an exception (the documentation is talking about a default setting of 15 seconds)

When I specify a TimeOut of 1, it takes about 10 seconds before to get the Exception

So I can say that this parameter have an effect anyway but it does not gives the expected result (15 seconds or 1 seconds)

Any Idea ?
Thanks for your Help

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2015-04-19 : 13:34:32
Show us your full connection string.



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page

olibara
Yak Posting Veteran

94 Posts

Posted - 2015-04-20 : 01:09:32
Thank for your reply
But I find the answer
But the connection string will not help
In fact setting the time out in the connexion string just define the MINIMUM time out for connexion to the Database
NOT the time spent to try to establish a connexion to the Network !

For my purpose I need to step down to test network connectivity
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2015-04-21 : 17:04:59
I disagree as 20+ year database programmer.
https://www.connectionstrings.com/all-sql-server-connection-string-keywords/



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page

olibara
Yak Posting Veteran

94 Posts

Posted - 2015-04-22 : 13:42:15
Thank you Swepeso

20+ Year and one more day and we can still learn !

http://improve.dk/controlling-sqlconnection-timeouts/

But I should have say MAXIMUM time of active connexion to the database
And as I said this not include the time spended to detect network

So for this matter, the connexion Timeout will parameter not help
Go to Top of Page
   

- Advertisement -