This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes Hunting leaking connections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Hunting leaking connections" Watch "Hunting leaking connections" New topic
Author

Hunting leaking connections

Jussi Taimiaho
Ranch Hand

Joined: Mar 01, 2004
Posts: 40
Hi,

to keep it short, a software running on WebLogic is leaking connections, so I'll need to fix this. The problem is not apparent, so it'll take a bit effort from me. I have a question about one case. Is this kind of structure any way vulnerable to leaking? I think not, but is it?


[ October 20, 2005: Message edited by: Jussi Taimiaho ]
dema rogatkin
Ranch Hand

Joined: Oct 09, 2002
Posts: 294
It looks Ok for me. I do not see any reason to rethrow exception though. Very unlekely but if a close ps throws runtime exception you can miss con.close().


Tough in space?, <a href="http://tjws.sf.net" target="_blank" rel="nofollow">Get J2EE servlet container under 150Kbytes here</a><br />Love your iPod and want it anywhere?<a href="http://mediachest.sf.net" target="_blank" rel="nofollow">Check it here.</a><br /><a href="http://7bee.j2ee.us/book/Generics%20in%20JDK%201.5.html" target="_blank" rel="nofollow">Curious about generic in Java?</a><br /><a href="http://7bee.j2ee.us/bee/index-bee.html" target="_blank" rel="nofollow">Hate ant? Use bee.</a><br /><a href="http://7bee.j2ee.us/addressbook/" target="_blank" rel="nofollow">Need contacts anywhere?</a><br /><a href="http://searchdir.sourceforge.net/" target="_blank" rel="nofollow">How to promote your business with a search engine</a>
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30050
    
149


This is a bit dangerous. You are doing something with an open connection. Here, it is possible to abandon some of the original resources without closing them.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jussi Taimiaho
Ranch Hand

Joined: Mar 01, 2004
Posts: 40
Originally posted by Jeanne Boyarsky:

This is a bit dangerous. You are doing something with an open connection. Here, it is possible to abandon some of the original resources without closing them.


I don't like this kind of structure either, but if I don't find the leak here I ain't going to touch classes using this style, since they are rather longish, and not written by me.

Thanks for the answers,
jussi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hunting leaking connections
 
Similar Threads
performance issue in iterating through large list of result set
ejbLoad is not getting called
get files from database
Problem in bmp entity bean while running client?
Missing IN or OUT parameter at index:: 1