Hello All,
I'm not sure, if this is the right forum to ask a question on connection leak, or
JDBC forum. But since the exception is coming from
tomcat dbcp, thought of starting from here. Lately, we are observing the AbandonedObjectException in our prod environment for few programs. We are using ojdbc6.jar and tomcat-dbcp from 6.0 version.
In most of the cases, where see this exception is when oracle.sql.ARRAY is created and used. We have a utility method which creates ARRAY object and returns to the calling functions to be used in passing as IN parameter to stored procedures. The psuedo code looks like below
We use this returned object and call the stored procedures with in another try/catch block with a new connection object and that object is also closed in finally block. I could not understand what and where the leak would have been possible and the connection object was abondoned.
There is one possibility I see here, in the creation of ARRAY, I see Connection is set to arrayDescriptor like "arraydescriptor.setConnection(connection);" I do not know, how this arrayDescriptor is later used during the stored procedure call, to which this ARRAY is passed IN. But as per the above code, the connection is closed, before returning back the ARRAY object. So, again I could not understand what is the impact on the connection that is set to ArrayDescriptor. But since there was no issue in making DB call and the values being returned properly, I believe what is being done here is correct.
Any pointers, what could have gone wrong with respect to the connection leak.