This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes Control the Connections in the Connection Pool? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Control the Connections in the Connection Pool?" Watch "Control the Connections in the Connection Pool?" New topic
Author

Control the Connections in the Connection Pool?

Namitha karupaiya
Ranch Hand

Joined: Mar 10, 2004
Posts: 89
I have developed an application using MySQL & JDBC and get the following error message time to time:

“In use connection equals maximum pool size… Cannot allocate more connections…”

I guess that my application has opened database connections but unable to close them because some exceptions may have occurred in the mid.

If I use JPA & EJB will the server take the responsibility to manage the connection pool automatically?

Thank you.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3825

Namitha karupaiya wrote:I have developed an application using MySQL & JDBC and get the following error message time to time:
“In use connection equals maximum pool size… Cannot allocate more connections…”
I guess that my application has opened database connections but unable to close them because some exceptions may have occurred in the mid.

You are not closing the connections in either catch or finally block in your code?

SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
 
 
subject: Control the Connections in the Connection Pool?