<p>What would be a very fast way to determine if your connectionstring lets you connect to a database?</p>

<p>Normally a connection attempt keeps the user waiting a long time before notifying the attempt was futile anyway.</p>

[{'answer_id': 10823, 'author': 'Keith', 'author_id': 905, 'author_profile': 'https://Stackoverflow.com/users/905', 'pm_score': 2, 'selected': False, 'text': '<p>Shorten the timeout on the connection string and execute something trivial.</p>\n\n<p>The wait should be about the same as the timeout.</p>\n\n<p>You would still need a second or two though.</p>\n'}, {'answer_id': 10824, 'author': 'GateKiller', 'author_id': 383, 'author_profile': 'https://Stackoverflow.com/users/383', 'pm_score': 5, 'selected': True, 'text': '<p>You haven\'t mentioned what database you are connecting to, however. In <a href="http://en.wikipedia.org/wiki/Microsoft_SQL_Server#SQL_Server_2005" rel="nofollow noreferrer">SQL Server 2005</a>, from .NET, you can specify a connection timeout in your connection string like so:</p>\n\n<pre><code>server=&lt;server&gt;;database=&lt;database&gt;;uid=&lt;user&gt;;password=&lt;password&gt;;Connect Timeout=3\n</code></pre>\n\n<p>This will try to connect to the server and if it doesn\'t do so in three seconds, it will throw a timeout error.</p>\n'}]
['https://Stackoverflow.com/questions/10822', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1271/']