none
which connections are closed by SqlConnection.ClearAllPools? RRS feed

  • Question

  • hi,

    I have an application which uses SqlConnection.ClearAllPools to close all connections before dropping a database.

    There is a case where a connection is still there. This connection had been created in another application domain.

    So I wonder which connections are closed by SqlConnection.ClearAllPools?

    • Only the connections opened by the calling process (or AppDomain)?
    • All the connections opened by this machine?
    • All the connections opened in the server machine?

    I can explain it in another way, I am running a windows forms application in my local machine. But I am using a database available in another test machine. When I am running my application, where does the application pool getting created?in my machine/in test machine?

    If I am using  SqlConnection.ClearAllPools in my application, which connections will be closed by this?

    Regards,

    Vidya


    Tuesday, March 20, 2012 10:20 AM

Answers

  • Connections are pooled per process, per application domain, per connection string and when integrated security is used, per Windows identity.

    Coming to Your Question no 1.

    Only the connections opened by the calling process (or AppDomain) are closed by SqlConnection.ClearAllPools.

    Question No 2.

    When I am running my application, where does the application pool getting created?in my machine/in test machine?

    Ans: When you run a .exe OS create a Process and a Application domain and ConnectionPool is going to be reside your Process->AppDomain.

    When you Call SqlConnection.ClearAllPools() Call, the above connectionpool is going to be cleared.


    Lingaraj Mishra


    Tuesday, March 20, 2012 2:05 PM

All replies

  • Connections are pooled per process, per application domain, per connection string and when integrated security is used, per Windows identity.

    Coming to Your Question no 1.

    Only the connections opened by the calling process (or AppDomain) are closed by SqlConnection.ClearAllPools.

    Question No 2.

    When I am running my application, where does the application pool getting created?in my machine/in test machine?

    Ans: When you run a .exe OS create a Process and a Application domain and ConnectionPool is going to be reside your Process->AppDomain.

    When you Call SqlConnection.ClearAllPools() Call, the above connectionpool is going to be cleared.


    Lingaraj Mishra


    Tuesday, March 20, 2012 2:05 PM
  • Hi Lingaraj ,

    Thanks  for your response.

    Regards,

    Vidya

    Friday, March 23, 2012 5:41 AM