Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ORA-01000: maximum open cursors exceeded  RSS feed

 
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting this below error.

Oracle/PLSQL: ORA-01000 Error

--------------------------------------------------------------------------------
Error:
ORA-01000: maximum open cursors exceeded


I am using hibernate with struts framework.

I am doing this in finally clause of each dao.


please help
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

ujjwal soni wrote:

Bad code. If rs is null, connection will never be closed.
And how about statements?
 
author
Bartender
Posts: 4093
21
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually even if rs is not null, it can still throw an exception preventing the connection from ever being closed. Each statement in the finally should have a try/catch around them. I wrote an article on closing JDBC resources some time back.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(Prepared)Statements are also expensive resources.
If you use connection pooling, the connection.close() won't close any opened Statements.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!