This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I am using weblogic(8.1 sp 3) connection pools in my application(java). But the connections are not closed properly. It seems there are lot of open connections.
I found a couple of places where the connections are closed in the try block. So if there is any error, they might be left open. But I am not sure if that would explain a lot of open connections(I need to wait couple of days to get the log file though, i am just going through the application now).
What would be the possible cases for this to happen? I also have a dumb question. Do we need to close the connection when we access the connection pools? Would it not close the connection altogether, thus reducing the size of the pool?
If so can anyone tell me how to return a connection to the pool.
Originally posted by vjy chin: What would be the possible cases for this to happen? I also have a dumb question. Do we need to close the connection when we access the connection pools? Would it not close the connection altogether, thus reducing the size of the pool?
Yes, you need to call connection.close() when using a connection pool. This is what tells the pool you are done with the connection and it can be allocated to someone else. The connection pool won't actually close the connection when you call this method. If you don't call connection.close(), you have a resource leak because connections are not returned to the connection pool.
can anyone tell me how to return a connection to the pool.
I got it now. But can you tell me of any possibilities in open connections? One is if an error occurs and the connection is not closed in te finally block, then there may be connections hanging. But any other possibilities?
Still waiting on the log file though. Also I checked the documents for weblogic connection pool and I found ways to look at connection pool leaks through code. But we are not using anything like that now. So is there any way I can debug this open connections problem?
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com