Win a copy of Java Challengers this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

maximum open cursor exceeded in java batch

Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have an issue when run the java batch, it return maximum cursor exceeded error.

here is the flow of code,

1.Created static connection the query in main method with this connection
3.The query return more than 1000 rows, but cursor maximum size is 1000.(i do not want to increase the cursor size)
4. i close the connection after each row performed some task.
5. But its not take any affect since the connection variable is static.

Could anyone suggest to correct this issue


Posts: 3837
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't know what database you're on, but generally the maximum open cursor limit does not limit number of rows you can read from a database. Instead, it limits number of statements that can be simultaneously processed.

Your point 4 looks suspicious to me. You should not close the connection until you're completely done with it. On the other hand, you should close the statement and resultset when you finish using it (but again, not sooner). Not closing the statement/resultset probably would cause the error you're experiencing, so check this.

By the way, a connection gets closed by calling the close() method. Regardless of whether the variable is static or not, this does close the connection.

If you post the code, you'll probably get better response than this one. We need to see what's really happening there.
The moustache of a titan! The ad of a flea:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic