This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes ora-0100 maximum number of cursors exceeds Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "ora-0100 maximum number of cursors exceeds" Watch "ora-0100 maximum number of cursors exceeds" New topic
Author

ora-0100 maximum number of cursors exceeds

vikram bollu
Greenhorn

Joined: Sep 07, 2009
Posts: 9
I am trying to insert more than 1 lac records, and it is inserting successfully. but the below exception is displaying...

ora-0100 maximum number of cursors exceeds

wht might be the reason for this and how to solve this.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

You are opening more connections than Oracle is configured to allow. Do you always close connections when you are finished with them?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
vikram bollu
Greenhorn

Joined: Sep 07, 2009
Posts: 9
Actually i am using one connection, and im adding all statements to batch ( statement.addBatch(); ).
For every 1000 statements im executing batach. If something happens wrong thn it should rollback everything.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Can we see your code?
vikram bollu
Greenhorn

Joined: Sep 07, 2009
Posts: 9
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874


close all your preparedStatement at the end of loop.
vikram bollu
Greenhorn

Joined: Sep 07, 2009
Posts: 9
Balu Sadhasivam wrote:
close all your preparedStatement at the end of loop.


Thanks for you reply,

Actually i had closed the connection in the finally block , is it required to closed the preparedstatement saparately??

Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874



Actually i had closed the connection in the finally block , is it required to closed the preparedstatement saparately??


Since you create statements inside loops , close at end of loop.. in all cases , check for null and close in finally block.
vikram bollu
Greenhorn

Joined: Sep 07, 2009
Posts: 9
thanks for your reply,

i will check for null and close it in the finally block.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ora-0100 maximum number of cursors exceeds
 
Similar Threads
hi,what cause this Exception?
SQLException
Q: repeatedly execute() on PreparedStatement without close()
Error message : ORA-01000: Maximum number of open cursors reached ??
Is it possible that number of open_cursors raise above maximum set limit