aspose file tools*
The moose likes JDBC and the fly likes Weblogic connection pool question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Weblogic connection pool question" Watch "Weblogic connection pool question" New topic
Author

Weblogic connection pool question

vjy chin
Ranch Hand

Joined: Feb 17, 2005
Posts: 279
Hi,

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.

Thanks.
[ August 07, 2007: Message edited by: vjy chin ]
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

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.

Just call connection.close();


[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
vjy chin
Ranch Hand

Joined: Feb 17, 2005
Posts: 279
Thanks Jeanne.

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?

Thanks.
 
Don't get me started about those stupid light bulbs.
 
subject: Weblogic connection pool question