db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <derby-...@db.apache.org>
Subject [jira] Commented: (DERBY-585) ResultSet overflows when rows are inserted.
Date Fri, 14 Apr 2006 02:01:01 GMT
    [ http://issues.apache.org/jira/browse/DERBY-585?page=comments#action_12374449 ] 

Bryan Pendleton commented on DERBY-585:
---------------------------------------

It's not completely clear to me what this test is trying to do, but I think that the behavior
of the system has changed and so the test no longer reproduces the bug that it intends to
reproduce.

I modified the test slightly so that it doesn't issue a println() on each iteration of the
while() loop, but instead only prints out a line of text every 50,000 times through the while
loop, and I built the program and ran it against the current Derby trunk.

I then let the test run for a while, and it ran through the while loop two million times without
any obvious problem. 

I wonder if this bug could have been related to DERBY-210, although that bug referred only
to *prepared* statements and this particular test program is generating *ordinary* JDBC statements
each time through the loop.

If the original poster could provide some information about how long the program is supposed
to be able to run before it hits the error, that would be useful in deciding whether or not
this bug has already been fixed by some other changes in the trunk.


> ResultSet overflows when rows are inserted.
> -------------------------------------------
>
>          Key: DERBY-585
>          URL: http://issues.apache.org/jira/browse/DERBY-585
>      Project: Derby
>         Type: Bug

>   Components: JDBC
>     Versions: 10.1.1.0
>  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
>     {
>         Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
>         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();
>         try
>         {
>             s.execute("drop table q");
>         }
>         catch (Exception e)
>         {
>             System.out.println(e.toString());
>         }
>         try
>         {
>             s.execute("create table q(q integer)");
>         }
>         catch (Exception e)
>         {
>             System.out.println(e.toString());
>         }
>         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.
>         conn.commit();
>         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)");
>         }
>         rs.close();
>         s.close();
>     }
> }
> 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:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message