[ 
https://issues.apache.org/jira/browse/DERBY-5425?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Knut Anders Hatlen closed DERBY-5425.
-------------------------------------

          Resolution: Fixed
       Fix Version/s: 10.9.1.1
                      10.8.2.3
    Issue & fix info: Repro attached  (was: Newcomer,Repro attached)

The compatibility tests failed the first two times I ran it on the 10.8 branch. 
It varied which combinations failed, and I couldn't see what caused it, only 
that some of the test cases failed with "database not found" errors. However, 
I've now re-run the compatibility tests many times without seeing the error 
again, so I'm assuming it was just a temporary environment problem and/or one 
of the instabilities in the tests' sub-process handling that we've cleaned up 
on trunk.

Merged to 10.9 with revision 1387111.
Merged to 10.8 with revision 1387112.
                
> Updateable holdable ResultSet terminates early after 65638 updates
> ------------------------------------------------------------------
>
>                 Key: DERBY-5425
>                 URL: https://issues.apache.org/jira/browse/DERBY-5425
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.7.1.1
>         Environment: ------------------ Java Information ------------------
> Java Version:    1.6.0_26
> Java Vendor:     Sun Microsystems Inc.
> Java home:       D:\Program Files (x86)\Java\jre6
> Java classpath:  .;..\derby.jar
> OS name:         Windows 7
> OS architecture: x86
> OS version:      6.1
> Java user name:  Andrew
> Java user home:  D:\Users\Andrew
> Java user dir:   E:\workspace\DerbyBug\bin
> java.specification.name: Java Platform API Specification
> java.specification.version: 1.6
> java.runtime.version: 1.6.0_26-b03
> --------- Derby Information --------
> JRE - JDBC: Java SE 6 - JDBC 4.0
> [E:\workspace\DerbyBug\derby.jar] 10.7.1.1 - (1040133)
> ------------------------------------------------------
> ----------------- Locale Information -----------------
> ------------------------------------------------------
>            Reporter: Andrew Johnson
>            Assignee: Knut Anders Hatlen
>              Labels: derby_triage10_9
>             Fix For: 10.8.2.3, 10.9.1.1, 10.10.0.0
>
>         Attachments: d5425-1a.diff.txt, DerbyBug.java, 
> holdable-row-holders.diff.txt
>
>
> After at least 65638 updates to an indexed column have been done via an 
> updateable holdable resultset and the transaction is committed 
> ResultSet.next() returns false even if more rows exist to be returned.
> The following program should output "Total: 100000" but instead outputs 
> "Total: 65638".
> import java.sql.Connection;
> import java.sql.DriverManager;
> import java.sql.PreparedStatement;
> import java.sql.ResultSet;
> import java.sql.SQLException;
> import java.sql.Statement;
> public class DerbyBug {
>       public static void main(String[] args) throws ClassNotFoundException, 
> SQLException {
>               Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
>               Connection conn = 
> DriverManager.getConnection("jdbc:derby:TestDB;create=true");
>               conn.setAutoCommit(false);
>               
>               Statement createStmt = conn.createStatement();
>               createStmt.executeUpdate("CREATE TABLE test (a INT)");
>               createStmt.executeUpdate("CREATE INDEX idxa ON test(a)");
>               createStmt.close();
>               
>               PreparedStatement insertStmt = conn.prepareStatement("INSERT 
> INTO test(a) VALUES (?)");
>               
>               for (int i = 0; i < 100000; ++i) {
>                       insertStmt.setInt(1, i);
>                       insertStmt.executeUpdate();
>               }
>               insertStmt.close();
>               
>               conn.commit();
>               
>               Statement selectStmt = 
> conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE, 
> ResultSet.HOLD_CURSORS_OVER_COMMIT);
>               ResultSet rs = selectStmt.executeQuery("SELECT a FROM test FOR 
> UPDATE");
>               
>               int count = 0;
>               while (rs.next()) {
>                       rs.updateInt(1, count);
>                       rs.updateRow();
>                       count++;
>                       
>                       conn.commit();
>               }
>               
>               rs.close();
>               selectStmt.close();
>               conn.commit();
>               conn.close();
>               System.out.println("Total: " + count);
>               
>               try {
>                       
> DriverManager.getConnection("jdbc:derby:;shutdown=true");
>               } catch (SQLException e) {
>                       if (!e.getSQLState().equals("XJ015")) {
>                               throw e;
>                       }
>               }
>       }
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to