If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Having problem with ResultSet

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-12-09, 17:00
swati malla swati malla is offline
Registered User
 
Join Date: Jul 2009
Posts: 26
Having problem with ResultSet

Hello Everyone,
I have an issue with resultset.
I am executing one query and gettign the resultset and passing that resultset to another method where i am traversing through the resultset.
When i iterate through the resultset i am getting exception
my code looks like:

//classOne
void methonone(){
String query="select * from tablenmae";
Connection.createstatement();//created the connection
Statement stmt = con.createStatement();//created the statement
ResultSet rsRows=stmt.executeQuery(query);//getting the result
methodtwo(rsRows)
}
// classTwo
void methodtwo(ResultSet rs){
rs.next()//throws an exception.
}

The exception is :
com.ibm.db2.jcc.b.SqlException: [jcc][t4][10120][10898][3.52.110] Invalid operation: result set is closed. ERRORCODE=-4470, SQLSTATE=null


I dont really know why the resultset is closed...
i would really appreciate if some one can help me out...

Thanks,
swati
Reply With Quote
  #2 (permalink)  
Old 08-13-09, 08:22
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Just handle the result set in the first method. And throw out the second method.

Andy
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On