• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to resolve "MAXIMUM OPEN CURSORS EXCEEDED"  RSS feed

 
Rajamanickam Palani
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

Good Morning/Evening...

Please provide some idea about how to handle the issue through java code and how to close the connections once thrown error.
Do you have any logic to handle the exception from java application?

Thanks,
Raja
 
Stephan van Hulst
Saloon Keeper
Posts: 7987
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One idea is to give us an SSCCE showing your problem.
 
Dave Tolls
Ranch Foreman
Posts: 3061
37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't handle that exception.
That exception says there is a bug in your code.
You fix the bug.

The fix is to close your db resources, with a try-with-resources block when you open them.
And to only hold onto a resource for the shortest period of time you can.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can get this exception if you do not properly close ResultSet and Statement objects when you're using the JDBC API.

Always call close() on ResultSet and Statement objects after you're done with them.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!