• Post Reply Bookmark Topic Watch Topic
  • New Topic

max DB connections exceeding issue  RSS feed

 
Uvindra DJ
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi people,

This is my first post so please be nice to me

Im connecting to a MySQL database from a stand alone java application via NetBeans 5

Sometimes the application does not display data from the database & when I check the connection through NetBeans I get an error saying that the Max No. of database connections has been reached in the JVM

I the coding in my application I have enclosed the the database connection within a try catch block which also includes a finaly statement.Within the finaly statement I check if any result sets or connections are open and I close them. So I dont quite understand how the no. of connections can continue to build up till the max limit is reached.

According to my knowledge I dont understand why this happens.Have I missed anything?

Thanks

Regards,
Uvindra
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have I missed anything?

Maybe you're not really closing and cleaning everything as needed.
It would be difficult to tell without seeing the code, but make sure all the Statement, ResultSet, Connection instances are closed in any place (best place would be the finally clause)
 
Uvindra DJ
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the advice, I'll recheck my code
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!