Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 360042

Summary: Result set closed after first record read.
Product: z_Archived Reporter: Paul Hoffman <hoffmanp>
Component: EDTAssignee: Project Inbox <edt.javagen-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: jvincens
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Test case
none
Supporting library for loading db / table none

Description Paul Hoffman CLA 2011-10-05 16:48:26 EDT
Created attachment 204637 [details]
Test case

See attached test case.    Output from test case:

connect to jdbc:derby:C:\EDT\derby\SAMPLE;create=true 
create schema
create table
Add row 1
Add row 2
Add row 3
Add row 4
Add row 5
Add row 6
Add row 7
Add row 8
Add row 9
Add row 10
Check row 1
Check row 10
Start test for defect:  result set closed after first record read
Open runs without exception
Try reading rows result set 
Row read:  1
Failure:  Exception = ResultSet not open. Operation 'next' not permitted. Verify that autocommit is OFF.: [sqlstate:XCL16][sqlcode:20,000]
Comment 1 Paul Hoffman CLA 2011-10-05 16:48:55 EDT
Created attachment 204638 [details]
Supporting library for loading db / table
Comment 2 Joseph Vincens CLA 2011-10-14 12:16:13 EDT
I believe this was fixed with other changes I made, so it works now.
I had to change the code to 
from
			for ( i from 1 to 10 )
				get row from rs ;
				log ( "Row read:  " + row.id ) ;
			end 

			for ( i from 1 to 10 )
				if(rs.setNext())
					get row from rs ;
					log ( "Row read:  " + row.id ) ;
				end
			end 
When using a resultSet you need to set its position before attempting to do a get.
Comment 3 Paul Hoffman CLA 2011-10-17 12:17:28 EDT
Issue resolved by other fixes