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

Control the Connections in the Connection Pool?

 
Namitha karupaiya
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic