Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 360042 - Result set closed after first record read.
Summary: Result set closed after first record read.
Status: CLOSED WORKSFORME
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-05 16:48 EDT by Paul Hoffman CLA
Modified: 2017-02-23 14:17 EST (History)
1 user (show)

See Also:


Attachments
Test case (1.02 KB, application/octet-stream)
2011-10-05 16:48 EDT, Paul Hoffman CLA
no flags Details
Supporting library for loading db / table (3.53 KB, application/octet-stream)
2011-10-05 16:48 EDT, Paul Hoffman CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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