This week's book giveaways are in the Jython/Python and Object-Oriented programming forums.
We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
    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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

error in jdbc

 
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Report post to moderator
i have a jdbc class that prints same result 10000 times,but it throws exception as show
java.sql.SQLException: ORA-01000: maximum open cursors exceeded

i know i can increase max number of cursors in oracle db.but db is located somewhere else so i cant do that.the code below throws exception when value of i=300.my requirement is that loop should print resultset 10000 times without any error.Code is show below please help me.
-----code-----------------------
for(10000 times)
String qs = "select * from scheduledJobs";
stmt = con.createStatement();
rs = stmt.executeQuery(qs);
while (rs.next()){
System.out.print(rs.getString("jobid");
System.out.print(rs.getString("interfaceid"));
}
}
rs.close();
stmt.close();
con.close();
 
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Report post to moderator
You are in the wrong forum, your message will be moved.
Anyways, have to tried closing the statement and resultset inside the loop. Looks like you are opening statement and resultset but not closing it.
 
But how did the elephant get like that? What did you do? I think all we can do now is read this tiny ad:
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!