wood burning stoves*
The moose likes JDBC and the fly likes Inputs needed writing a tool to resolve Connection leakage problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Inputs needed writing a tool to resolve Connection leakage problem" Watch "Inputs needed writing a tool to resolve Connection leakage problem" New topic
Author

Inputs needed writing a tool to resolve Connection leakage problem

dumb dumber
Greenhorn

Joined: Oct 04, 2009
Posts: 2
Hi All,

I am maintaining and existing application which is inconsistently giving Connection leakage problem. Due to the size of the application its not possible for me to go through all DAO classes and check if all connection/resultsets/statements have been closed properly.

I am thinking of writing a generic code which can analyse methods of a java/class file and see if all connection/resultsets/statements have been closed properly.

I thought of using java.lang.reflect but i think using that i can only get the method signature/params/returns type but getting into the method may not be possible.

Please me know if anyone has any idea or efficient approach of doing this rather than going through the class line by line.
dumb dumber
Greenhorn

Joined: Oct 04, 2009
Posts: 2
Any takers???
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

If you're using Apace DBCP, then try passing "removeAbondend" & "logAbandoned" parameters to the connection string, it will collect all the not closed connection once the time out and logs the method/classes who're culprit.
More info:
http://commons.apache.org/dbcp/configuration.html

Also change your display name, we don't like to call you as a "dumb dumber" ;)


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2499
    
    8

Sagar Rohankar wrote:... "logAbandoned" parameters to the connection string, ... and logs the method/classes who're culprit....
Sagar, thank you for this info. I love it when I learn something new on the ranch. (Also shows that I should read my documents better, doesn't it?)


OCUP UML fundamental and ITIL foundation
youtube channel
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Welcome, Jan ! Its just a matter of fact that I personally get stuck for the 15 days configuring the DBCP with MySQL, thats consequently forced me to read the DBCP docs/guide ;)

And I'm learning from your post, too (especially your quite active in DBCP section )
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Inputs needed writing a tool to resolve Connection leakage problem