aspose file tools*
The moose likes Websphere and the fly likes RAD 7.0 - V61 ResultSet reference is lost Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "RAD 7.0 - V61 ResultSet reference is lost" Watch "RAD 7.0 - V61 ResultSet reference is lost" New topic
Author

RAD 7.0 - V61 ResultSet reference is lost

Kavitha Chandrasekaran
Ranch Hand

Joined: Jul 24, 2002
Posts: 34
Hi,

I am in the process of migrating an app from V5 to V61 in RAD 7.0. I am connecting to the DB fine, bringing back data etc.

I am having trouble in this one scenario.
Example:
- ResultSet is created
- for each row in the ResultSet, additional SQL is done to get more info.
- when the control comes back to processing the next row in the ResultSet, the reference to the ResultSet is completely lost.

I am using the same connection to perform the additional SQL, taht ccreated the ResultSet too.

This application has been running in production for years and I am having the problem only in RAD 7.0.

Anyone experience similar issue? Please help.

Thank You.
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1


What would the reason be fore the resultset being lost?

Turn on the debugger and step through that code. Is the reference being set to null? Do you have the reference, but is it bringing back nulls when you go to the next row?

Maybe you could show us a small snippet of the code and we could help you out.

Are you using datasources? Is the cursor losing a connetion to the database or something? Are there any pertinent error messages in the logs?

-Cameron McKenzie
Kavitha Chandrasekaran
Ranch Hand

Joined: Jul 24, 2002
Posts: 34
Hi Cameron,

I di dmost of what you said and have answers. I will compile and post them shortly.

Thanks.

Kavitha
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18669
    
    8

Kavitha Chandrasekaran wrote:for each row in the ResultSet, additional SQL is done to get more info.


I don't see much information about the problem -- what does "lost" mean? -- are there error messages? -- and so on. So taking a wild guess, this just looks to me like you didn't see what the API documentation for java.sql.Statement says:

By default, only one ResultSet object per Statement object can be open at the same time. Therefore, if the reading of one ResultSet object is interleaved with the reading of another, each must have been generated by different Statement objects. All execution methods in the Statement interface implicitly close a statment's current ResultSet object if an open one exists.


Of course, as I said, there was no code posted or anything like that, so this is just a guess.
Kavitha Chandrasekaran
Ranch Hand

Joined: Jul 24, 2002
Posts: 34
Paul and Cameron,

Please find the details.

Thanks.




Kavitha Chandrasekaran
Ranch Hand

Joined: Jul 24, 2002
Posts: 34
Paul,

Shown below is the part of code that creates the second result set. The 2 result sets are created in different SQL statements in different methods.

So you think it could be my local setting in RAD 7.0. Becuase this code currently works in V51 - for years.

Thanks.
Kavitha Chandrasekaran
Ranch Hand

Joined: Jul 24, 2002
Posts: 34
I am using the same connection to create the two result sets. But the result sets are created from 2 different statements. This is acceptable right?
Kavitha Chandrasekaran
Ranch Hand

Joined: Jul 24, 2002
Posts: 34
Problem resolved

The setting that I had to change was under Admin Console  Data sources > DB2 Universal JDBC Driver DataSource > Custom properties > resultSetHoldabilityValue was set to 1.
and it worked.

“Determine whether ResultSets are closed or kept open when committing a transaction. The possible values are: 1 (HOLD_CURSORS_OVER_COMMIT), 2 (CLOSE_CURSORS_AT_COMMIT).”

Thanks
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: RAD 7.0 - V61 ResultSet reference is lost