Reputation: 690
I am using Oracle Managed connection in .Net 7 web api with connection pool enabled.
Whenever database team perform deployment, which might temporarily invalidate DB package state (which is resolved immediately by recompiling effected DB objects). At same time, if there is any open connection, it returns ORA-04068: existing state of package has been discarded.
.
But even after DB packages are validated, still I am receiving same error. Workaround to solve this issue is to reset Application pool in IIS.
Can this because of Pooling? I believe pool manager provide connection information, while above statement happens if command text executes. Then why this behavior, until I clear connections from pool (Reset IIS).
I also explicitly OracleConnection.ClearPool(connection) after each execution (test purpose), and I never face such issue.
I am searching best approach to manage connection pooling. As you can see my current approach is highly dependent.
following information for reference.
Runtime: .Net 7 OD: Oracle.ManageDataAccess.Core 3.21.1
try{
OpenConnection();
OracleCommand cmd = .......;
await cmd.ExecuteNonQueryAsync();
}
catch
{
}
finally
{
connection.Close();
connection.Dispose();
// OracleConnection.ClearPool(connection); // Clear pool explicitly. works
connection = null;
}
Upvotes: 1
Views: 89