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!
    Bookmark Topic Watch Topic
  • New Topic

error in jdbc

 
Gowher Naik
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();
 
Jay Ashar
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.
 
    Bookmark Topic Watch Topic
  • New Topic