Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Detect Oracle Exception ORA-04068

4049070Jul 22 2019 — edited Jul 24 2019

Dear All,

I am connecting to an Oracle Database via Oracle.ManagedDataAccess.Core 2.19.31 (Database is Oracle 12c)

Pooling is enabled and when a package is recompiled on the DB we get ORA-04068 5 times (where 5 is the number of opened pool on the connection).

What I was able to accomplish is to execute the query in a try catch block and call OracleConnection.ResetPools().

That worked,since I was able to invalidate all the pools and get a smooth running on a new retry (wanted behavior). However, I am not satisfied with my solution because we will likely miss the try catch block in the code we will write in the future.

What I want to accomplish is to attach myself to something provided by the OracleConnection at a global level, detect the error and reset the connection automatically, so that developer won't have to care about it in this and in all the other projects we are developing.

OracleConnection.InfoMessage seems perfect, this is what the documentation reports: This event is triggered for any message or warning sent by the database.

However, this event is never triggered in my code, even when I get exceptions from the DB..

Am I loosing something? Do you have other solutions/idea?

BTW, keep in mind this:

Validate Connection attribute is not an option, since it is not efficient and our customer is really sensitive on that subject.

"Registering an Event Handler for Failover/TAF callbacks" is not an option either, since it is not supported by the managed dll.

Thank you in advance.

Best regards,

Mirko

Comments

Post Details

Added on Jul 22 2019
7 comments
513 views