I make run of test connection, I expect to see clear session browser, but at the end of the program, I see more then 6 sessions in my session browser
This is the code:
private void testConnection()
{
string connectionString = "data source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=1111)(PORT=1699))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = abcd)));Min Pool Size=10; Connection Lifetime=120;";
OracleConnection oraConn = new OracleConnection(connectionString);
try
{
oraConn.Open();
}
catch (Exception e)
{
}
finally
{
oraConn.Dispose();
oraConn.Close();
}
}
I need a solution to close session totaly.
You should clear the pool:
finally
{
oraConn.Dispose();
oraConn.Close();
OracleConnection.ClearPool(oraConn);
}
The reason is likely connection pooling. From MSDN:
OracleConnection.Close Method
The Close method rolls back any pending transactions. It then releases the connection to the connection pool, or closes the connection if connection pooling is disabled.
So, your connection instance will get disposed of within C# but the connection may stay open in the pool, so that a new open connection instance may be quickly provided the next time you request one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With