This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ORA-01000: maximum open cursors exceeded

 
ujjwal soni
Ranch Hand
Posts: 403
  • 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
 
Bauke Scholtz
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?
 
Scott Selikoff
author
Saloon Keeper
Posts: 4008
18
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic