db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philip Wilder (JIRA)" <derby-...@db.apache.org>
Subject [jira] Commented: (DERBY-213) ResultSet.next() after last row of FORWARD_ONLY cursor throws an SQL Exception with Network Server
Date Thu, 16 Jun 2005 13:52:47 GMT
    [ http://issues.apache.org/jira/browse/DERBY-213?page=comments#action_12313824 ] 

Philip Wilder commented on DERBY-213:

***** Update *****
It would seem that the nature of the problem has changed. Stemming from our discussions surrounding
the issue Kathey and I have come to the conclusion that the current method of ResultSet comitting
is convoluted in some regards and broken in others. At the moment all of the Commit logic
is found in the client.am.Result.closeX() method which is being called improperly on the final
ResultSet.next() call and little effort is made to accommodate multiple ResultSets per Statement.
In order to address this issue we propose the following 2 steps:

1) Move the commit logic out of client.am.ResultSet, place it in client.am.Statement and generally
adapt a format that more closely follows Embedded model. Hopefully in the days that follow
I will be able to provide a more concrete implementation for analysis.

2) Develop a series of tests that more fully probe the different combinations of commit functionality
(ResultSet.CLOSE_CURSORS_AT_COMMIT vs ResultSet.HOLD_CURORS_ON_COMMIT, autoCommit == true
vs autocommit == false, etc.)

> ResultSet.next() after last row of FORWARD_ONLY cursor throws an SQL Exception with Network
> --------------------------------------------------------------------------------------------------
>          Key: DERBY-213
>          URL: http://issues.apache.org/jira/browse/DERBY-213
>      Project: Derby
>         Type: Bug
>   Components: Network Client
>     Versions:
>     Reporter: Kathey Marsden
>     Assignee: Philip Wilder
>  Attachments: Client.java, Create.java, DERBY-213_6_13_2005.txt, DERBY-213_6_9_2005.txt,
DERBY-213_irc_6_3_2005, DERBY-213_irc_6_7_2005.txt, DERBY-213_irc_6_8_2005, IRCTranscript_June2_2005.txt,
ResultSet Outline.pdf, Server.java, resultset.java
> Network Server closes the result set if ResultSet.next() is 
> called after the last row of the result set.  The test code 
> below throws the following exception.
> SQLState:   null
> Severity: -99999
> Message:  Invalid operation: result set closed
> com.ibm.db2.jcc.am.SqlException: Invalid operation: result set 
> closed
>         at 
> com.ibm.db2.jcc.am.ResultSet.checkForClosedResultSet(ResultSet.j
> ava:3419)
>         at 
> com.ibm.db2.jcc.am.ResultSet.nextX(ResultSet.java:290)
>         at 
> com.ibm.db2.jcc.am.ResultSet.next(ResultSet.java:277)
>         at AfterLast.test(AfterLast.java:75)
>         at AfterLast.main(AfterLast.java:32)
> stmt.executeUpdate("CREATE  TABLE TAB ( I INT)");
> stmt.executeUpdate("INSERT INTO TAB VALUES(1)");
> stmt.executeUpdate("INSERT INTO TAB VALUES(2)");
> String sql ="SELECT * from tab";		
> ps = conn.prepareStatement(sql);
> ResultSet rs = ps.executeQuery();
> System.out.println(sql);
> while (rs.next())
> System.out.println(rs.getInt(1));
> try {
> 	System.out.println("one more next");
> 	rs.next();
> 		}
>     catch (Exception e)
> 		{
> 		System.out.println("FAIL: next should return false not throw 
> exception");
> 		e.printStackTrace();
> 		}

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message