Invalid connection in the connection pool


Graham Allwood


does anyone know how I can determine if a connection in the connection pool
has become invalid?

The problem I have is that I'm hosting some remote components in IIS and
these components use ADO.NET to connected to SqlServer. Now, connection
pooling is enabled so if the backend Sql database goes down for a short
while and then comes back up, all connections in the pool are now invalid
and the next time I try and use one I get an exception. I need to be able to
distinguish this from a real database problem and an invalid poolled

does anyone have any ideas?

Thanks for any help


Miha Markic

Hi Graham,

You can't.
However, the first time you try to use invalid connection will
understand that it is invalid and it will remove it from pool.
Or, when you get an exception on connection, try using the same connection
string+ one whitespace at the end - that will trigger new connecition ...

Graham Allwood

Thanks for that, but is that the only way? Is there any way I could
distinguish the exception being thrown as one that is caused by an invalid
pooled connection?

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