File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Oracle/OAS and the fly likes DriverManagerConnection PoolConnection  Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "DriverManagerConnection PoolConnection  Error" Watch "DriverManagerConnection PoolConnection  Error" New topic

DriverManagerConnection PoolConnection Error

himanshu patel
Ranch Hand

Joined: Feb 03, 2003
Posts: 205
Hello Everybody,
I am getting one problem in J2EE application.
I am using Oracle OC4j.
I have hundreds of method which opens Connection (JDBC) object and explicitly closes at the end of method inside finally {} block. It works fine for almost all methods. But for some method I am getting following errors messages.
DriverManagerConnection PoolConnection not closed, check your code!
(Use -Djdbc.connection.debug=true to find out where the leaked connection was created)
Despite of this error, the method works as expected. I do not understand why this happens when
I am releasing connection object at the end of every method inside finally {} block. And to my surprise I am getting this error only for 1-2 methods. I have used same Connection Handling mechanism for all methods.
Could anyone help me to sort out this problem.
Any suggestion is highly appreciated.

If you want to become a rich, do not work for others but make others to work for you.
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Just from a design point of view. Is the calls to Opening and closing the connection done directly in each method, Or do you have some sort of Utility class that it can call a method to open and another call to close.
That way if the connection information needs to change, say for a new DBMS or a different Connection String, you do not have to change it in a hundred places. You can just change it in the Utility class.
Could you be using up your connections that are in the Pool. Like lets say you only have 5 connections in you connection pool, and this method that has the error, is in a chain of 6 method calls as in, meth1 calls meth2 which calls meth3, which calls meth4, which calls meth5, which calls meth6. In this case you are down 6 levels and each level is using up a connection from the connection pool, until you have no more connections.

Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: DriverManagerConnection PoolConnection Error
It's not a secret anymore!