• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with db2driver

 
manohar koppuravuri
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am getting the following exception
com.ibm.db2.jcc.b.SqlException: Invalid operation: result set closed
I am using db2, what i am doing is

if(rs.next){
do some thing
while(rs.next()){
do some thing else
}
}

The above code i have wrote in one scenario, it is working with oracle and sqlserver. But with db2 it is failing, i know when rs.next() in while loop reaches end of rows in table it returns false and also it is getting closed. when again it comes to the if condition it is failing and throwing the exception, because i am calling the rs.next() after closing the resultset because it is my requirement.

I am using Resultset.Type_Forward_Only. even i tried with scroll_sensitive and scroll_insensitive also.

Caused by: com.ibm.db2.jcc.b.SqlException: Invalid operation: result set closed
at com.ibm.db2.jcc.b.rc.mb(rc.java:3413)
at com.ibm.db2.jcc.b.rc.c(rc.java:290)
at com.ibm.db2.jcc.b.rc.next(rc.java:277)
at com.soa.monitoring.export.UsageExporter.writeRow(UsageExporter.java:121)
... 19 more



Can some one help me on this issue..
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
 
Marilyn de Queiroz
Sheriff
Posts: 9067
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Is this code inside another loop?
Does the while loop need to be inside the if statement?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic