It's not a secret anymore!*
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 Murach's Java Servlets and JSP this week in the Servlets 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: 3816

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]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Control the Connections in the Connection Pool?
 
Similar Threads
Simple Que Abt Connection Pool
Store Connection Pool
How do the connections get closed in Connection Pool
Variables scope
Connection Pooling Help Needed