convert dbconnection to sqlconnection RRS feed

  • Question

  • User2027942032 posted


    I need to clear the connection pool. how do i do this with DBconnection object? 

    Monday, December 21, 2009 8:54 PM


All replies

  • User187056398 posted

    I need to clear the connection pool.

    I don't think you do Wink

    In any event, I doubt that functionality would ever be exposed to an application because that application could wreak havoc with other applications.

    Monday, December 21, 2009 9:02 PM
  • User2011918074 posted


    I need to clear the connection pool. how do i do this with DBconnection object? 



    SqlConnection is a derived class of DbConnection.  Based on different databases and data providers, we have different derived classes of DbConnection, like OdbcConnection, OleDbConnection, OracleConnection and SqlConnection.

    SqlConnection declared some new methods to handle the connection pool, but its parent class DbConnection does not have such methods.

    For SqlConnection, there are two methods to clear the pool, please see:

    SqlConnection.ClearPool Method

    SqlConnection.ClearAllPools Method

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 24, 2009 4:42 AM
  • User187056398 posted


    If you have trouble finding the functions (like I did) they are static functions of SqlConnection. 

    Thanks Jian Kang.

    Thursday, December 24, 2009 10:50 AM
  • User-1600963911 posted

    Thank you, Steve, for pointing it out.  I almost gave up in seeking a method to clear connection pools before reading your post.

    Now, I assume one can clear a pool like the following:

    SqlConnection.ClearPool(new SqlConnection(dbConnection.ConnectionString));

    I am not 100% sure, but this what I will try.

    Tuesday, October 22, 2013 5:07 PM