db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thierry de Pretto (JIRA)" <derby-...@db.apache.org>
Subject [jira] Created: (DERBY-585) ResultSet overflows when rows are inserted.
Date Fri, 23 Sep 2005 11:40:29 GMT
ResultSet overflows when rows are inserted.

         Key: DERBY-585
         URL: http://issues.apache.org/jira/browse/DERBY-585
     Project: Derby
        Type: Bug
  Components: JDBC  
 Environment: Red Hat Enterprise Linux ES release 3 (Taroon Update 4), intel
    Reporter: Thierry de Pretto

Derby jdbc driver doesn't seem to be able to find the end of a
ResultSet when rows are inserted while the ResultSet is walked. For
instance, the execution of the code 

import java.sql.Connection;
import java.sql.Statement;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.ResultSet;
import java.sql.DriverManager;

public class Test
    public static void main(String[] pArgs) throws Exception
        String url = "jdbc:derby://localhost:1527/sample";
//         Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
//         String url = "jdbc:derby:/tmp/sample;create=true";
        Connection conn = DriverManager.getConnection(url);
        Statement s = conn.createStatement();
            s.execute("drop table q");
        catch (Exception e)
            s.execute("create table q(q integer)");
        catch (Exception e)
        PreparedStatement p = conn.prepareStatement("insert into q values (1)");
//        for (int i = 0; i<=10; i++) { p.executeUpdate();} // it works for small table.
        for (int i = 0; i<=10000; i++) { p.executeUpdate();} // it never ends for big table.
        ResultSet rs = s.executeQuery("SELECT q FROM q");
        System.out.println("q, w");
        while (rs.next()) {
            int q = rs.getInt("q");
            System.out.println(""+ q);
            conn.createStatement().execute("insert into q values (2)");

ends with exception

Exception in thread "main" org.apache.derby.client.am.SqlException: Run out of sections to
use,sections limited to 32k currently
	at org.apache.derby.client.am.SectionManager.getSection(Unknown Source)
	at org.apache.derby.client.am.SectionManager.getDynamicSection(Unknown Source)
	at org.apache.derby.client.am.Statement.flowExecute(Unknown Source)
	at org.apache.derby.client.am.Statement.executeX(Unknown Source)
	at org.apache.derby.client.am.Statement.execute(Unknown Source)
	at Test.main(Test.java:95)

if table q is big enough because ResultSet.next() seems to retrieve
the rows inserted after the select execution. Note that it also occurs
for join statement.

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