This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Weblogic connection pool question

 
vjy chin
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34394
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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();
 
vjy chin
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic