File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes IDEs, Version Control and other tools and the fly likes plugin - DB connection leak Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "plugin - DB connection leak" Watch "plugin - DB connection leak" New topic
Author

plugin - DB connection leak

Muse Ran
Ranch Hand

Joined: Sep 17, 2008
Posts: 317
hi all
Is there any tool plugin for Eclipse to check any connection leak in the java source code. There are huge code base, and it is diffcult to search through each page.

thanks in advance


Tomorrow will surely be a new day!!!
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Connection leak? What sort of connection leaks? Are you talking JDBC/RMI/Socket?


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Muse Ran
Ranch Hand

Joined: Sep 17, 2008
Posts: 317
Hi
Basically i want to check the database connections - opened in the java source code and forget to close in the code. If i have few java files i can check manually, if the number is more, i cannt check each and every file. Thats why i am looking for tool (plugin) to check any opened java database connections in the code.

Thanks
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16158
    
  21

There's no way to check statically. However you can set up to run for a while, monitor the network socket connections and if they begin to build up, take a profile snapshot and backtrace to see where the allocations were being made. Unfortunately, one of the best ways to leak connections is to not intercept exceptions and close the connection on the way back up the stack. Which is why I like the Spring Framework. It handles stuff like that.

Also, most of the ORM implementations afford some protection (or at least traceability) on things like this.

But that's small consolation when you inherit a lot of ugly old code done with brute-force JDBC.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: plugin - DB connection leak