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 > DB2 resultset closed automatically

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-09-04, 08:53
yogeshts yogeshts is offline
Registered User
 
Join Date: Apr 2004
Posts: 2
DB2 resultset closed automatically

I am using UDB 8.0 on AIX. I am using type 4 driver (db2jcc.jar) and my Web application
runs on Websphere.I call a stored procedure/sql (witih an EJB method) that returns me a resultSet of few records.I traverse thru the result set using a simple while(rs.next()) { ...}. When I do this, an SQLException is thrown saying "Invalid operation : result set closed".

I found this to happen in 4 Scenarios.

Case 1:
When there is no row in the resultset and i try to do a rs.next().( doesnt throw the exception always. works fine in few places )

Case 2:
When I traverse beyond the last record and i try to do a rs.next().( always throws the exception. looks like a valid case... but i dont get this in oracle )

Case 3:
We are using hibernate as our DAO layer to interact with the database. While traversing forward through the resultset, if i use the same connection( which had created the resultset using a preparedstatement ) to inititialize a hibernate session, the rs.next() immediately following the initialization throws me the exception.

Case 4:
when i do a rs.next(), even if the resultset has records and the cusror position is valid . ( again this doesnt happen always .. works fine in most places )

I feel some configuration parameter is missing which is causing this problem.

Would really appreciate, if anyone could give me hints what could be going wrong ?
Reply With Quote
  #2 (permalink)  
Old 04-12-04, 08:04
J Petruk J Petruk is offline
Registered User
 
Join Date: Mar 2004
Location: Toronto, ON, Canada
Posts: 513
Re: DB2 resultset closed automatically

Quote:
Originally posted by yogeshts
I am using UDB 8.0 on AIX. I am using type 4 driver (db2jcc.jar) and my Web application
runs on Websphere.I call a stored procedure/sql (witih an EJB method) that returns me a resultSet of few records.I traverse thru the result set using a simple while(rs.next()) { ...}. When I do this, an SQLException is thrown saying "Invalid operation : result set closed".

I found this to happen in 4 Scenarios.

Case 1:
When there is no row in the resultset and i try to do a rs.next().( doesnt throw the exception always. works fine in few places )

Case 2:
When I traverse beyond the last record and i try to do a rs.next().( always throws the exception. looks like a valid case... but i dont get this in oracle )

Case 3:
We are using hibernate as our DAO layer to interact with the database. While traversing forward through the resultset, if i use the same connection( which had created the resultset using a preparedstatement ) to inititialize a hibernate session, the rs.next() immediately following the initialization throws me the exception.

Case 4:
when i do a rs.next(), even if the resultset has records and the cusror position is valid . ( again this doesnt happen always .. works fine in most places )

I feel some configuration parameter is missing which is causing this problem.

Would really appreciate, if anyone could give me hints what could be going wrong ?
This sounds like very strange (buggy) behaviour... what is hibernate?

rs.next() should return false if there are no rows/none left, it shouldn't thrown an exception unless something else is wrong.

You might want to take a JDBC/CLI trace, although at that point engaging IBM support might be a good call. You can spend a lot of time mucking around with those.
__________________
--
Jonathan Petruk
DB2 Database Consultant
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