Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RAD 7.0 - V61 ResultSet reference is lost

 
Kavitha Chandrasekaran
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Cameron,

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

Thanks.

Kavitha
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul and Cameron,

Please find the details.

Thanks.




 
Kavitha Chandrasekaran
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic