B
Brian Adams
My application is a two-tier desktop application hitting SQL server
via Ado.Net using the System.Data.SqlClient namespace.
The administrative portion application needs to gain exclusive access
to our database in order to perform some maintanence operations on the
database (restoring one or two tables). This part of the application
is maintained separately from the rest of the system. During this
time, we do not want our user interface to have to shut down.
The problem we are having is that the SqlClient namespace keeps the
open connections in its connection pool -- I cannot find a way to
force the pool to disconnect all of its connections.
My options at this point are:
(1) Not use connection pooling; I would prefer to maintain the pool as
some of our code is shared with a web application.
(2) Use SQL server to kill the outstanding pooled connections. We are
not sure that our users are configured with sufficient security.
(3) Configure the lifetime of connections to some low value and force
the user to wait some amount of time for the connections to die
and (4) Find a way to force the pool to clear out all connections to
the database. We only ever attach using a single connection string, so
only one pool would need to be cleared (I'm also fine clearing
everything out 'brute force').
So my questions: Is there a way to accomplish (4) without resorting to
reflecting through the internals of System.Data.SqlClient? and is
there a more appropriate solution that I'm missing?
Thanks for any help!
-Brian
via Ado.Net using the System.Data.SqlClient namespace.
The administrative portion application needs to gain exclusive access
to our database in order to perform some maintanence operations on the
database (restoring one or two tables). This part of the application
is maintained separately from the rest of the system. During this
time, we do not want our user interface to have to shut down.
The problem we are having is that the SqlClient namespace keeps the
open connections in its connection pool -- I cannot find a way to
force the pool to disconnect all of its connections.
My options at this point are:
(1) Not use connection pooling; I would prefer to maintain the pool as
some of our code is shared with a web application.
(2) Use SQL server to kill the outstanding pooled connections. We are
not sure that our users are configured with sufficient security.
(3) Configure the lifetime of connections to some low value and force
the user to wait some amount of time for the connections to die
and (4) Find a way to force the pool to clear out all connections to
the database. We only ever attach using a single connection string, so
only one pool would need to be cleared (I'm also fine clearing
everything out 'brute force').
So my questions: Is there a way to accomplish (4) without resorting to
reflecting through the internals of System.Data.SqlClient? and is
there a more appropriate solution that I'm missing?
Thanks for any help!
-Brian