Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ora-0100 maximum number of cursors exceeds

 
vikram bollu
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are opening more connections than Oracle is configured to allow. Do you always close connections when you are finished with them?
 
vikram bollu
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we see your code?
 
vikram bollu
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

close all your preparedStatement at the end of loop.
 
vikram bollu
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your reply,

i will check for null and close it in the finally block.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic