aspose file tools*
The moose likes JDBC and the fly likes Result Sets and odd reactions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Result Sets and odd reactions" Watch "Result Sets and odd reactions" New topic
Author

Result Sets and odd reactions

Dale DeMott
Ranch Hand

Joined: Nov 02, 2000
Posts: 515
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)


By failing to prepare, you are preparing to fail.<br />Benjamin Franklin (1706 - 1790)
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

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


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

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

Joined: Jan 30, 2000
Posts: 18671
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.


"I'm not back." - Bill Harding, Twister
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Thanks for that, I went looking but didn't find it.

Dave
Dale DeMott
Ranch Hand

Joined: Nov 02, 2000
Posts: 515
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)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Result Sets and odd reactions
 
Similar Threads
Result Sets and odd reactions
A mistake in K&B book?
VisualAge for Java Repository on Mainframe
Java and DB2
EBCDIC to ASCII Conversion