• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Result Sets and odd reactions

 
Dale DeMott
Ranch Hand
Posts: 515
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's the deal. I do the following code on my NT box against an DB2 database and this fails. If I push this up to the os/390 environment, it works. I tracked it down to be this. If I retrieve the same piece of information from the record set twice, it fails on NT.. but works on the os/390. I have a work around... I already have that solved.. my question is WHY would this happen.

Regards,
Dale DeMott
------------------
By failing to prepare, you are preparing to fail.
Benjamin Franklin (1706 - 1790)
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm going to move this over to JDBC, but leave a locked version of the question here. Please visit the JDBC forum if you can help Dale out.

------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like "one of those driver things". As a basic rule, no, you can't read the same thing twice so you have to read it and store it in a variable then use the variable twice.
Dave.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is covered in the ResultSet API:
The ResultSet interface provides getXXX methods for retrieving column values from the current row. Values can be retrieved using either the index number of the column or the name of the column. In general, using the column index will be more efficient. Columns are numbered from 1. For maximum portability, result set columns within each row should be read in left-to-right order, and each column should be read only once.

You should definitely be able to read left-to right once. Anything else depends on your driver.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for that, I went looking but didn't find it.

Dave
 
Dale DeMott
Ranch Hand
Posts: 515
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay.. I can see that. So the record set is still attached somehow to the driver still. Is this true??
Dale

------------------
By failing to prepare, you are preparing to fail.
Benjamin Franklin (1706 - 1790)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic