You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Kathey Marsden (JIRA)" <ji...@apache.org> on 2008/04/25 17:35:56 UTC

[jira] Created: (DERBY-3645) Insert into selecting BLOB column twice leads to SQLException: Restore of a serializable or SQLData object of class error selecting from the table

Insert into selecting BLOB column twice leads to SQLException: Restore of a serializable or SQLData object of class error selecting from the table
--------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: DERBY-3645
                 URL: https://issues.apache.org/jira/browse/DERBY-3645
             Project: Derby
          Issue Type: Bug
          Components: SQL
    Affects Versions: 10.3.2.2, 10.4.1.4, 10.5.0.0
            Reporter: Kathey Marsden


The following code which inserts into a table by selecting a blob column twice from another table, causes SQLException: Restore of a serializable or SQLData object of class error selecting from the table. See attached program DoubleInsertInto for full repro.  Stack trace is below.  Verified back to 10.3 but probably goes back further.



        s.executeUpdate("CREATE TABLE T_MAIN(" +
                "ID INT  GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " +
                "V BLOB(590473235) )");

        String ins1 = "INSERT INTO T_MAIN(V) VALUES (?)";
        
        PreparedStatement ps;
        ps = c.prepareStatement(ins1);
	byte[] bytes = new byte[35000];
	for (int i = 0; i < 35000; i++)
	    bytes[i] = (byte) i ;
	ps.setBytes(1, bytes);
        ps.executeUpdate();
        ps.close();

	s.executeUpdate("CREATE TABLE T_COPY ( V1 BLOB(2M), V2 BLOB(2M))");

	Statement stmt = c.createStatement();
	stmt.executeUpdate("INSERT INTO T_COPY SELECT  V, V FROM T_MAIN");
	ResultSet rs = stmt.executeQuery("SELECT * FROM T_COPY");
	rs.next();
	String v1 = rs.getString(1);
	String v2 = rs.getString(2);
	System.out.println("v1:" + v1);
	System.out.println("v2:" + v2);
	System.out.println("I am done");

Exception in thread "main" java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to re
ad more data than was originally stored
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
        at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:223)
        at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:398)
        at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
        at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2125)
        at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
        at org.apache.derby.impl.jdbc.EmbedResultSet.closeOnTransactionError(EmbedResultSet.java:4320)
        at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:463)
        at org.apache.derby.impl.jdbc.EmbedResultSet.next(EmbedResultSet.java:367)
        at DoubleInsertInto.main(DoubleInsertInto.java:47)
Caused by: java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to read more data tha
n was originally stored
        at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11
9)
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
        ... 10 more
Caused by: java.sql.SQLException: Java exception: ': java.io.EOFException'.
        at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11
9)
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
        at org.apache.derby.impl.jdbc.Util.javaException(Util.java:244)
        at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
        ... 8 more
Caused by: java.io.EOFException
        at org.apache.derby.iapi.types.SQLBinary.readBinaryLength(SQLBinary.java:350)
        at org.apache.derby.iapi.types.SQLBinary.readExternalFromArray(SQLBinary.java:328)
        at org.apache.derby.impl.store.raw.data.StoredPage.readRecordFromArray(StoredPage.java:5568)
        at org.apache.derby.impl.store.raw.data.StoredPage.restoreRecordFromSlot(StoredPage.java:1497)
        at org.apache.derby.impl.store.raw.data.BasePage.fetchFromSlot(BasePage.java:459)
        at org.apache.derby.impl.store.access.conglomerate.GenericScanController.fetchRows(GenericScanController.java:75
9)
        at org.apache.derby.impl.store.access.heap.HeapScan.fetchNextGroup(HeapScan.java:324)
        at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.reloadArray(BulkTableScanResultSet.java:327)
        at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.getNextRowCore(BulkTableScanResultSet.java:282)
        at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(BasicNoPutResultSetImpl.java:460)
        at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:423)
        ... 2 more

































































-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3645) Insert into selecting BLOB column twice leads to SQLException: Restore of a serializable or SQLData object of class error selecting from the table

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3645?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden updated DERBY-3645:
----------------------------------

    Attachment: DoubleInsertInto.java

> Insert into selecting BLOB column twice leads to SQLException: Restore of a serializable or SQLData object of class error selecting from the table
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3645
>                 URL: https://issues.apache.org/jira/browse/DERBY-3645
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.2.2, 10.4.1.4, 10.5.0.0
>            Reporter: Kathey Marsden
>         Attachments: DoubleInsertInto.java
>
>
> The following code which inserts into a table by selecting a blob column twice from another table, causes SQLException: Restore of a serializable or SQLData object of class error selecting from the table. See attached program DoubleInsertInto for full repro.  Stack trace is below.  Verified back to 10.3 but probably goes back further.
>         s.executeUpdate("CREATE TABLE T_MAIN(" +
>                 "ID INT  GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " +
>                 "V BLOB(590473235) )");
>         String ins1 = "INSERT INTO T_MAIN(V) VALUES (?)";
>         
>         PreparedStatement ps;
>         ps = c.prepareStatement(ins1);
> 	byte[] bytes = new byte[35000];
> 	for (int i = 0; i < 35000; i++)
> 	    bytes[i] = (byte) i ;
> 	ps.setBytes(1, bytes);
>         ps.executeUpdate();
>         ps.close();
> 	s.executeUpdate("CREATE TABLE T_COPY ( V1 BLOB(2M), V2 BLOB(2M))");
> 	Statement stmt = c.createStatement();
> 	stmt.executeUpdate("INSERT INTO T_COPY SELECT  V, V FROM T_MAIN");
> 	ResultSet rs = stmt.executeQuery("SELECT * FROM T_COPY");
> 	rs.next();
> 	String v1 = rs.getString(1);
> 	String v2 = rs.getString(2);
> 	System.out.println("v1:" + v1);
> 	System.out.println("v2:" + v2);
> 	System.out.println("I am done");
> Exception in thread "main" java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to re
> ad more data than was originally stored
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
>         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
>         at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:223)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:398)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
>         at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2125)
>         at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.closeOnTransactionError(EmbedResultSet.java:4320)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:463)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.next(EmbedResultSet.java:367)
>         at DoubleInsertInto.main(DoubleInsertInto.java:47)
> Caused by: java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to read more data tha
> n was originally stored
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11
> 9)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
>         ... 10 more
> Caused by: java.sql.SQLException: Java exception: ': java.io.EOFException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11
> 9)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
>         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
>         at org.apache.derby.impl.jdbc.Util.javaException(Util.java:244)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
>         ... 8 more
> Caused by: java.io.EOFException
>         at org.apache.derby.iapi.types.SQLBinary.readBinaryLength(SQLBinary.java:350)
>         at org.apache.derby.iapi.types.SQLBinary.readExternalFromArray(SQLBinary.java:328)
>         at org.apache.derby.impl.store.raw.data.StoredPage.readRecordFromArray(StoredPage.java:5568)
>         at org.apache.derby.impl.store.raw.data.StoredPage.restoreRecordFromSlot(StoredPage.java:1497)
>         at org.apache.derby.impl.store.raw.data.BasePage.fetchFromSlot(BasePage.java:459)
>         at org.apache.derby.impl.store.access.conglomerate.GenericScanController.fetchRows(GenericScanController.java:75
> 9)
>         at org.apache.derby.impl.store.access.heap.HeapScan.fetchNextGroup(HeapScan.java:324)
>         at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.reloadArray(BulkTableScanResultSet.java:327)
>         at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.getNextRowCore(BulkTableScanResultSet.java:282)
>         at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(BasicNoPutResultSetImpl.java:460)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:423)
>         ... 2 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DERBY-3645) Insert into selecting BLOB column twice leads to SQLException: Restore of a serializable or SQLData object of class error selecting from the table

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3645?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden resolved DERBY-3645.
-----------------------------------

         Assignee: Dag H. Wanvik  (was: Kathey Marsden)
    Fix Version/s: 10.5.3.1
       Resolution: Fixed

This was back ported with the fix for DERBY-3646 to 10.5
Resolving and assigning to Dag.




> Insert into selecting BLOB column twice leads to SQLException: Restore of a serializable or SQLData object of class error selecting from the table
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3645
>                 URL: https://issues.apache.org/jira/browse/DERBY-3645
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.3.0, 10.4.2.0, 10.5.1.1
>            Reporter: Kathey Marsden
>            Assignee: Dag H. Wanvik
>             Fix For: 10.5.3.1, 10.6.1.0
>
>         Attachments: DoubleInsertInto.java
>
>
> The following code which inserts into a table by selecting a blob column twice from another table, causes SQLException: Restore of a serializable or SQLData object of class error selecting from the table. See attached program DoubleInsertInto for full repro.  Stack trace is below.  Verified back to 10.3 but probably goes back further.
>         s.executeUpdate("CREATE TABLE T_MAIN(" +
>                 "ID INT  GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " +
>                 "V BLOB(590473235) )");
>         String ins1 = "INSERT INTO T_MAIN(V) VALUES (?)";
>         
>         PreparedStatement ps;
>         ps = c.prepareStatement(ins1);
> 	byte[] bytes = new byte[35000];
> 	for (int i = 0; i < 35000; i++)
> 	    bytes[i] = (byte) i ;
> 	ps.setBytes(1, bytes);
>         ps.executeUpdate();
>         ps.close();
> 	s.executeUpdate("CREATE TABLE T_COPY ( V1 BLOB(2M), V2 BLOB(2M))");
> 	Statement stmt = c.createStatement();
> 	stmt.executeUpdate("INSERT INTO T_COPY SELECT  V, V FROM T_MAIN");
> 	ResultSet rs = stmt.executeQuery("SELECT * FROM T_COPY");
> 	rs.next();
> 	String v1 = rs.getString(1);
> 	String v2 = rs.getString(2);
> 	System.out.println("v1:" + v1);
> 	System.out.println("v2:" + v2);
> 	System.out.println("I am done");
> Exception in thread "main" java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to re
> ad more data than was originally stored
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
>         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
>         at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:223)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:398)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
>         at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2125)
>         at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.closeOnTransactionError(EmbedResultSet.java:4320)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:463)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.next(EmbedResultSet.java:367)
>         at DoubleInsertInto.main(DoubleInsertInto.java:47)
> Caused by: java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to read more data tha
> n was originally stored
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11
> 9)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
>         ... 10 more
> Caused by: java.sql.SQLException: Java exception: ': java.io.EOFException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11
> 9)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
>         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
>         at org.apache.derby.impl.jdbc.Util.javaException(Util.java:244)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
>         ... 8 more
> Caused by: java.io.EOFException
>         at org.apache.derby.iapi.types.SQLBinary.readBinaryLength(SQLBinary.java:350)
>         at org.apache.derby.iapi.types.SQLBinary.readExternalFromArray(SQLBinary.java:328)
>         at org.apache.derby.impl.store.raw.data.StoredPage.readRecordFromArray(StoredPage.java:5568)
>         at org.apache.derby.impl.store.raw.data.StoredPage.restoreRecordFromSlot(StoredPage.java:1497)
>         at org.apache.derby.impl.store.raw.data.BasePage.fetchFromSlot(BasePage.java:459)
>         at org.apache.derby.impl.store.access.conglomerate.GenericScanController.fetchRows(GenericScanController.java:75
> 9)
>         at org.apache.derby.impl.store.access.heap.HeapScan.fetchNextGroup(HeapScan.java:324)
>         at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.reloadArray(BulkTableScanResultSet.java:327)
>         at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.getNextRowCore(BulkTableScanResultSet.java:282)
>         at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(BasicNoPutResultSetImpl.java:460)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:423)
>         ... 2 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3645) Insert into selecting BLOB column twice leads to SQLException: Restore of a serializable or SQLData object of class error selecting from the table

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592455#action_12592455 ] 

Kathey Marsden commented on DERBY-3645:
---------------------------------------

Interestingly, if I change the copy table to have the same size BLOB.  I get wrong results instead.
s.executeUpdate("CREATE TABLE T_COPY ( V1 BLOB(590473235), V2 BLOB(590473235))");
v1:000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f....
v2:9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9ba

This is more similar to the DERBY-2349 case.


> Insert into selecting BLOB column twice leads to SQLException: Restore of a serializable or SQLData object of class error selecting from the table
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3645
>                 URL: https://issues.apache.org/jira/browse/DERBY-3645
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.2.2, 10.4.1.4, 10.5.0.0
>            Reporter: Kathey Marsden
>         Attachments: DoubleInsertInto.java
>
>
> The following code which inserts into a table by selecting a blob column twice from another table, causes SQLException: Restore of a serializable or SQLData object of class error selecting from the table. See attached program DoubleInsertInto for full repro.  Stack trace is below.  Verified back to 10.3 but probably goes back further.
>         s.executeUpdate("CREATE TABLE T_MAIN(" +
>                 "ID INT  GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " +
>                 "V BLOB(590473235) )");
>         String ins1 = "INSERT INTO T_MAIN(V) VALUES (?)";
>         
>         PreparedStatement ps;
>         ps = c.prepareStatement(ins1);
> 	byte[] bytes = new byte[35000];
> 	for (int i = 0; i < 35000; i++)
> 	    bytes[i] = (byte) i ;
> 	ps.setBytes(1, bytes);
>         ps.executeUpdate();
>         ps.close();
> 	s.executeUpdate("CREATE TABLE T_COPY ( V1 BLOB(2M), V2 BLOB(2M))");
> 	Statement stmt = c.createStatement();
> 	stmt.executeUpdate("INSERT INTO T_COPY SELECT  V, V FROM T_MAIN");
> 	ResultSet rs = stmt.executeQuery("SELECT * FROM T_COPY");
> 	rs.next();
> 	String v1 = rs.getString(1);
> 	String v2 = rs.getString(2);
> 	System.out.println("v1:" + v1);
> 	System.out.println("v2:" + v2);
> 	System.out.println("I am done");
> Exception in thread "main" java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to re
> ad more data than was originally stored
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
>         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
>         at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:223)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:398)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
>         at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2125)
>         at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.closeOnTransactionError(EmbedResultSet.java:4320)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:463)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.next(EmbedResultSet.java:367)
>         at DoubleInsertInto.main(DoubleInsertInto.java:47)
> Caused by: java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to read more data tha
> n was originally stored
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11
> 9)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
>         ... 10 more
> Caused by: java.sql.SQLException: Java exception: ': java.io.EOFException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11
> 9)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
>         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
>         at org.apache.derby.impl.jdbc.Util.javaException(Util.java:244)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
>         ... 8 more
> Caused by: java.io.EOFException
>         at org.apache.derby.iapi.types.SQLBinary.readBinaryLength(SQLBinary.java:350)
>         at org.apache.derby.iapi.types.SQLBinary.readExternalFromArray(SQLBinary.java:328)
>         at org.apache.derby.impl.store.raw.data.StoredPage.readRecordFromArray(StoredPage.java:5568)
>         at org.apache.derby.impl.store.raw.data.StoredPage.restoreRecordFromSlot(StoredPage.java:1497)
>         at org.apache.derby.impl.store.raw.data.BasePage.fetchFromSlot(BasePage.java:459)
>         at org.apache.derby.impl.store.access.conglomerate.GenericScanController.fetchRows(GenericScanController.java:75
> 9)
>         at org.apache.derby.impl.store.access.heap.HeapScan.fetchNextGroup(HeapScan.java:324)
>         at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.reloadArray(BulkTableScanResultSet.java:327)
>         at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.getNextRowCore(BulkTableScanResultSet.java:282)
>         at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(BasicNoPutResultSetImpl.java:460)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:423)
>         ... 2 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3645) Insert into selecting BLOB column twice leads to SQLException: Restore of a serializable or SQLData object of class error selecting from the table

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3645?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-3645:
--------------------------------------

         Description: 
The following code which inserts into a table by selecting a blob column twice from another table, causes SQLException: Restore of a serializable or SQLData object of class error selecting from the table. See attached program DoubleInsertInto for full repro.  Stack trace is below.  Verified back to 10.3 but probably goes back further.



        s.executeUpdate("CREATE TABLE T_MAIN(" +
                "ID INT  GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " +
                "V BLOB(590473235) )");

        String ins1 = "INSERT INTO T_MAIN(V) VALUES (?)";
        
        PreparedStatement ps;
        ps = c.prepareStatement(ins1);
	byte[] bytes = new byte[35000];
	for (int i = 0; i < 35000; i++)
	    bytes[i] = (byte) i ;
	ps.setBytes(1, bytes);
        ps.executeUpdate();
        ps.close();

	s.executeUpdate("CREATE TABLE T_COPY ( V1 BLOB(2M), V2 BLOB(2M))");

	Statement stmt = c.createStatement();
	stmt.executeUpdate("INSERT INTO T_COPY SELECT  V, V FROM T_MAIN");
	ResultSet rs = stmt.executeQuery("SELECT * FROM T_COPY");
	rs.next();
	String v1 = rs.getString(1);
	String v2 = rs.getString(2);
	System.out.println("v1:" + v1);
	System.out.println("v2:" + v2);
	System.out.println("I am done");

Exception in thread "main" java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to re
ad more data than was originally stored
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
        at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:223)
        at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:398)
        at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
        at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2125)
        at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
        at org.apache.derby.impl.jdbc.EmbedResultSet.closeOnTransactionError(EmbedResultSet.java:4320)
        at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:463)
        at org.apache.derby.impl.jdbc.EmbedResultSet.next(EmbedResultSet.java:367)
        at DoubleInsertInto.main(DoubleInsertInto.java:47)
Caused by: java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to read more data tha
n was originally stored
        at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11
9)
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
        ... 10 more
Caused by: java.sql.SQLException: Java exception: ': java.io.EOFException'.
        at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11
9)
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
        at org.apache.derby.impl.jdbc.Util.javaException(Util.java:244)
        at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
        ... 8 more
Caused by: java.io.EOFException
        at org.apache.derby.iapi.types.SQLBinary.readBinaryLength(SQLBinary.java:350)
        at org.apache.derby.iapi.types.SQLBinary.readExternalFromArray(SQLBinary.java:328)
        at org.apache.derby.impl.store.raw.data.StoredPage.readRecordFromArray(StoredPage.java:5568)
        at org.apache.derby.impl.store.raw.data.StoredPage.restoreRecordFromSlot(StoredPage.java:1497)
        at org.apache.derby.impl.store.raw.data.BasePage.fetchFromSlot(BasePage.java:459)
        at org.apache.derby.impl.store.access.conglomerate.GenericScanController.fetchRows(GenericScanController.java:75
9)
        at org.apache.derby.impl.store.access.heap.HeapScan.fetchNextGroup(HeapScan.java:324)
        at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.reloadArray(BulkTableScanResultSet.java:327)
        at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.getNextRowCore(BulkTableScanResultSet.java:282)
        at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(BasicNoPutResultSetImpl.java:460)
        at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:423)
        ... 2 more

  was:
The following code which inserts into a table by selecting a blob column twice from another table, causes SQLException: Restore of a serializable or SQLData object of class error selecting from the table. See attached program DoubleInsertInto for full repro.  Stack trace is below.  Verified back to 10.3 but probably goes back further.



        s.executeUpdate("CREATE TABLE T_MAIN(" +
                "ID INT  GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " +
                "V BLOB(590473235) )");

        String ins1 = "INSERT INTO T_MAIN(V) VALUES (?)";
        
        PreparedStatement ps;
        ps = c.prepareStatement(ins1);
	byte[] bytes = new byte[35000];
	for (int i = 0; i < 35000; i++)
	    bytes[i] = (byte) i ;
	ps.setBytes(1, bytes);
        ps.executeUpdate();
        ps.close();

	s.executeUpdate("CREATE TABLE T_COPY ( V1 BLOB(2M), V2 BLOB(2M))");

	Statement stmt = c.createStatement();
	stmt.executeUpdate("INSERT INTO T_COPY SELECT  V, V FROM T_MAIN");
	ResultSet rs = stmt.executeQuery("SELECT * FROM T_COPY");
	rs.next();
	String v1 = rs.getString(1);
	String v2 = rs.getString(2);
	System.out.println("v1:" + v1);
	System.out.println("v2:" + v2);
	System.out.println("I am done");

Exception in thread "main" java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to re
ad more data than was originally stored
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
        at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:223)
        at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:398)
        at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
        at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2125)
        at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
        at org.apache.derby.impl.jdbc.EmbedResultSet.closeOnTransactionError(EmbedResultSet.java:4320)
        at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:463)
        at org.apache.derby.impl.jdbc.EmbedResultSet.next(EmbedResultSet.java:367)
        at DoubleInsertInto.main(DoubleInsertInto.java:47)
Caused by: java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to read more data tha
n was originally stored
        at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11
9)
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
        ... 10 more
Caused by: java.sql.SQLException: Java exception: ': java.io.EOFException'.
        at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11
9)
        at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
        at org.apache.derby.impl.jdbc.Util.javaException(Util.java:244)
        at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
        ... 8 more
Caused by: java.io.EOFException
        at org.apache.derby.iapi.types.SQLBinary.readBinaryLength(SQLBinary.java:350)
        at org.apache.derby.iapi.types.SQLBinary.readExternalFromArray(SQLBinary.java:328)
        at org.apache.derby.impl.store.raw.data.StoredPage.readRecordFromArray(StoredPage.java:5568)
        at org.apache.derby.impl.store.raw.data.StoredPage.restoreRecordFromSlot(StoredPage.java:1497)
        at org.apache.derby.impl.store.raw.data.BasePage.fetchFromSlot(BasePage.java:459)
        at org.apache.derby.impl.store.access.conglomerate.GenericScanController.fetchRows(GenericScanController.java:75
9)
        at org.apache.derby.impl.store.access.heap.HeapScan.fetchNextGroup(HeapScan.java:324)
        at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.reloadArray(BulkTableScanResultSet.java:327)
        at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.getNextRowCore(BulkTableScanResultSet.java:282)
        at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(BasicNoPutResultSetImpl.java:460)
        at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:423)
        ... 2 more

































































    Issue & fix info: [High Value Fix, Repro attached]  (was: [High Value Fix])
             Urgency: Normal

Triaged for 10.5.2.

> Insert into selecting BLOB column twice leads to SQLException: Restore of a serializable or SQLData object of class error selecting from the table
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3645
>                 URL: https://issues.apache.org/jira/browse/DERBY-3645
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.3.0, 10.4.2.0, 10.5.1.1
>            Reporter: Kathey Marsden
>         Attachments: DoubleInsertInto.java
>
>
> The following code which inserts into a table by selecting a blob column twice from another table, causes SQLException: Restore of a serializable or SQLData object of class error selecting from the table. See attached program DoubleInsertInto for full repro.  Stack trace is below.  Verified back to 10.3 but probably goes back further.
>         s.executeUpdate("CREATE TABLE T_MAIN(" +
>                 "ID INT  GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " +
>                 "V BLOB(590473235) )");
>         String ins1 = "INSERT INTO T_MAIN(V) VALUES (?)";
>         
>         PreparedStatement ps;
>         ps = c.prepareStatement(ins1);
> 	byte[] bytes = new byte[35000];
> 	for (int i = 0; i < 35000; i++)
> 	    bytes[i] = (byte) i ;
> 	ps.setBytes(1, bytes);
>         ps.executeUpdate();
>         ps.close();
> 	s.executeUpdate("CREATE TABLE T_COPY ( V1 BLOB(2M), V2 BLOB(2M))");
> 	Statement stmt = c.createStatement();
> 	stmt.executeUpdate("INSERT INTO T_COPY SELECT  V, V FROM T_MAIN");
> 	ResultSet rs = stmt.executeQuery("SELECT * FROM T_COPY");
> 	rs.next();
> 	String v1 = rs.getString(1);
> 	String v2 = rs.getString(2);
> 	System.out.println("v1:" + v1);
> 	System.out.println("v2:" + v2);
> 	System.out.println("I am done");
> Exception in thread "main" java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to re
> ad more data than was originally stored
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
>         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
>         at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:223)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:398)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
>         at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2125)
>         at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.closeOnTransactionError(EmbedResultSet.java:4320)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:463)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.next(EmbedResultSet.java:367)
>         at DoubleInsertInto.main(DoubleInsertInto.java:47)
> Caused by: java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to read more data tha
> n was originally stored
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11
> 9)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
>         ... 10 more
> Caused by: java.sql.SQLException: Java exception: ': java.io.EOFException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11
> 9)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
>         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
>         at org.apache.derby.impl.jdbc.Util.javaException(Util.java:244)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
>         ... 8 more
> Caused by: java.io.EOFException
>         at org.apache.derby.iapi.types.SQLBinary.readBinaryLength(SQLBinary.java:350)
>         at org.apache.derby.iapi.types.SQLBinary.readExternalFromArray(SQLBinary.java:328)
>         at org.apache.derby.impl.store.raw.data.StoredPage.readRecordFromArray(StoredPage.java:5568)
>         at org.apache.derby.impl.store.raw.data.StoredPage.restoreRecordFromSlot(StoredPage.java:1497)
>         at org.apache.derby.impl.store.raw.data.BasePage.fetchFromSlot(BasePage.java:459)
>         at org.apache.derby.impl.store.access.conglomerate.GenericScanController.fetchRows(GenericScanController.java:75
> 9)
>         at org.apache.derby.impl.store.access.heap.HeapScan.fetchNextGroup(HeapScan.java:324)
>         at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.reloadArray(BulkTableScanResultSet.java:327)
>         at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.getNextRowCore(BulkTableScanResultSet.java:282)
>         at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(BasicNoPutResultSetImpl.java:460)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:423)
>         ... 2 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3645) Insert into selecting BLOB column twice leads to SQLException: Restore of a serializable or SQLData object of class error selecting from the table

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3645?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden updated DERBY-3645:
----------------------------------

    Derby Categories: [Data corruption, High Value Fix]

> Insert into selecting BLOB column twice leads to SQLException: Restore of a serializable or SQLData object of class error selecting from the table
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3645
>                 URL: https://issues.apache.org/jira/browse/DERBY-3645
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.3.0, 10.4.1.4, 10.5.0.0
>            Reporter: Kathey Marsden
>         Attachments: DoubleInsertInto.java
>
>
> The following code which inserts into a table by selecting a blob column twice from another table, causes SQLException: Restore of a serializable or SQLData object of class error selecting from the table. See attached program DoubleInsertInto for full repro.  Stack trace is below.  Verified back to 10.3 but probably goes back further.
>         s.executeUpdate("CREATE TABLE T_MAIN(" +
>                 "ID INT  GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " +
>                 "V BLOB(590473235) )");
>         String ins1 = "INSERT INTO T_MAIN(V) VALUES (?)";
>         
>         PreparedStatement ps;
>         ps = c.prepareStatement(ins1);
> 	byte[] bytes = new byte[35000];
> 	for (int i = 0; i < 35000; i++)
> 	    bytes[i] = (byte) i ;
> 	ps.setBytes(1, bytes);
>         ps.executeUpdate();
>         ps.close();
> 	s.executeUpdate("CREATE TABLE T_COPY ( V1 BLOB(2M), V2 BLOB(2M))");
> 	Statement stmt = c.createStatement();
> 	stmt.executeUpdate("INSERT INTO T_COPY SELECT  V, V FROM T_MAIN");
> 	ResultSet rs = stmt.executeQuery("SELECT * FROM T_COPY");
> 	rs.next();
> 	String v1 = rs.getString(1);
> 	String v2 = rs.getString(2);
> 	System.out.println("v1:" + v1);
> 	System.out.println("v2:" + v2);
> 	System.out.println("I am done");
> Exception in thread "main" java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to re
> ad more data than was originally stored
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
>         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
>         at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:223)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:398)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
>         at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2125)
>         at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.closeOnTransactionError(EmbedResultSet.java:4320)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:463)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.next(EmbedResultSet.java:367)
>         at DoubleInsertInto.main(DoubleInsertInto.java:47)
> Caused by: java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to read more data tha
> n was originally stored
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11
> 9)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
>         ... 10 more
> Caused by: java.sql.SQLException: Java exception: ': java.io.EOFException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11
> 9)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
>         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
>         at org.apache.derby.impl.jdbc.Util.javaException(Util.java:244)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
>         ... 8 more
> Caused by: java.io.EOFException
>         at org.apache.derby.iapi.types.SQLBinary.readBinaryLength(SQLBinary.java:350)
>         at org.apache.derby.iapi.types.SQLBinary.readExternalFromArray(SQLBinary.java:328)
>         at org.apache.derby.impl.store.raw.data.StoredPage.readRecordFromArray(StoredPage.java:5568)
>         at org.apache.derby.impl.store.raw.data.StoredPage.restoreRecordFromSlot(StoredPage.java:1497)
>         at org.apache.derby.impl.store.raw.data.BasePage.fetchFromSlot(BasePage.java:459)
>         at org.apache.derby.impl.store.access.conglomerate.GenericScanController.fetchRows(GenericScanController.java:75
> 9)
>         at org.apache.derby.impl.store.access.heap.HeapScan.fetchNextGroup(HeapScan.java:324)
>         at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.reloadArray(BulkTableScanResultSet.java:327)
>         at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.getNextRowCore(BulkTableScanResultSet.java:282)
>         at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(BasicNoPutResultSetImpl.java:460)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:423)
>         ... 2 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DERBY-3645) Insert into selecting BLOB column twice leads to SQLException: Restore of a serializable or SQLData object of class error selecting from the table

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3645?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kristian Waagan resolved DERBY-3645.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 10.6.0.0

Fixed by the combination of DERBY-4477 and DERBY-4520.
Verified against trunk revision 980933, but it would be nice if the reporter verified the fix as well.

I do not plan to back-port the fix(es) due to the rather signficant changes involved, but it may be technically possible.

> Insert into selecting BLOB column twice leads to SQLException: Restore of a serializable or SQLData object of class error selecting from the table
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3645
>                 URL: https://issues.apache.org/jira/browse/DERBY-3645
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.3.0, 10.4.2.0, 10.5.1.1
>            Reporter: Kathey Marsden
>             Fix For: 10.6.0.0
>
>         Attachments: DoubleInsertInto.java
>
>
> The following code which inserts into a table by selecting a blob column twice from another table, causes SQLException: Restore of a serializable or SQLData object of class error selecting from the table. See attached program DoubleInsertInto for full repro.  Stack trace is below.  Verified back to 10.3 but probably goes back further.
>         s.executeUpdate("CREATE TABLE T_MAIN(" +
>                 "ID INT  GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " +
>                 "V BLOB(590473235) )");
>         String ins1 = "INSERT INTO T_MAIN(V) VALUES (?)";
>         
>         PreparedStatement ps;
>         ps = c.prepareStatement(ins1);
> 	byte[] bytes = new byte[35000];
> 	for (int i = 0; i < 35000; i++)
> 	    bytes[i] = (byte) i ;
> 	ps.setBytes(1, bytes);
>         ps.executeUpdate();
>         ps.close();
> 	s.executeUpdate("CREATE TABLE T_COPY ( V1 BLOB(2M), V2 BLOB(2M))");
> 	Statement stmt = c.createStatement();
> 	stmt.executeUpdate("INSERT INTO T_COPY SELECT  V, V FROM T_MAIN");
> 	ResultSet rs = stmt.executeQuery("SELECT * FROM T_COPY");
> 	rs.next();
> 	String v1 = rs.getString(1);
> 	String v2 = rs.getString(2);
> 	System.out.println("v1:" + v1);
> 	System.out.println("v2:" + v2);
> 	System.out.println("I am done");
> Exception in thread "main" java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to re
> ad more data than was originally stored
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
>         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
>         at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:223)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:398)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
>         at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2125)
>         at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.closeOnTransactionError(EmbedResultSet.java:4320)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:463)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.next(EmbedResultSet.java:367)
>         at DoubleInsertInto.main(DoubleInsertInto.java:47)
> Caused by: java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to read more data tha
> n was originally stored
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11
> 9)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
>         ... 10 more
> Caused by: java.sql.SQLException: Java exception: ': java.io.EOFException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11
> 9)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
>         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
>         at org.apache.derby.impl.jdbc.Util.javaException(Util.java:244)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
>         ... 8 more
> Caused by: java.io.EOFException
>         at org.apache.derby.iapi.types.SQLBinary.readBinaryLength(SQLBinary.java:350)
>         at org.apache.derby.iapi.types.SQLBinary.readExternalFromArray(SQLBinary.java:328)
>         at org.apache.derby.impl.store.raw.data.StoredPage.readRecordFromArray(StoredPage.java:5568)
>         at org.apache.derby.impl.store.raw.data.StoredPage.restoreRecordFromSlot(StoredPage.java:1497)
>         at org.apache.derby.impl.store.raw.data.BasePage.fetchFromSlot(BasePage.java:459)
>         at org.apache.derby.impl.store.access.conglomerate.GenericScanController.fetchRows(GenericScanController.java:75
> 9)
>         at org.apache.derby.impl.store.access.heap.HeapScan.fetchNextGroup(HeapScan.java:324)
>         at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.reloadArray(BulkTableScanResultSet.java:327)
>         at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.getNextRowCore(BulkTableScanResultSet.java:282)
>         at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(BasicNoPutResultSetImpl.java:460)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:423)
>         ... 2 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (DERBY-3645) Insert into selecting BLOB column twice leads to SQLException: Restore of a serializable or SQLData object of class error selecting from the table

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3645?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden reassigned DERBY-3645:
-------------------------------------

    Assignee: Kathey Marsden

assigning to myself for back port to 10.5


> Insert into selecting BLOB column twice leads to SQLException: Restore of a serializable or SQLData object of class error selecting from the table
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3645
>                 URL: https://issues.apache.org/jira/browse/DERBY-3645
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.3.0, 10.4.2.0, 10.5.1.1
>            Reporter: Kathey Marsden
>            Assignee: Kathey Marsden
>             Fix For: 10.6.1.0
>
>         Attachments: DoubleInsertInto.java
>
>
> The following code which inserts into a table by selecting a blob column twice from another table, causes SQLException: Restore of a serializable or SQLData object of class error selecting from the table. See attached program DoubleInsertInto for full repro.  Stack trace is below.  Verified back to 10.3 but probably goes back further.
>         s.executeUpdate("CREATE TABLE T_MAIN(" +
>                 "ID INT  GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " +
>                 "V BLOB(590473235) )");
>         String ins1 = "INSERT INTO T_MAIN(V) VALUES (?)";
>         
>         PreparedStatement ps;
>         ps = c.prepareStatement(ins1);
> 	byte[] bytes = new byte[35000];
> 	for (int i = 0; i < 35000; i++)
> 	    bytes[i] = (byte) i ;
> 	ps.setBytes(1, bytes);
>         ps.executeUpdate();
>         ps.close();
> 	s.executeUpdate("CREATE TABLE T_COPY ( V1 BLOB(2M), V2 BLOB(2M))");
> 	Statement stmt = c.createStatement();
> 	stmt.executeUpdate("INSERT INTO T_COPY SELECT  V, V FROM T_MAIN");
> 	ResultSet rs = stmt.executeQuery("SELECT * FROM T_COPY");
> 	rs.next();
> 	String v1 = rs.getString(1);
> 	String v2 = rs.getString(2);
> 	System.out.println("v1:" + v1);
> 	System.out.println("v2:" + v2);
> 	System.out.println("I am done");
> Exception in thread "main" java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to re
> ad more data than was originally stored
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
>         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
>         at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:223)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:398)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
>         at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2125)
>         at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.closeOnTransactionError(EmbedResultSet.java:4320)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:463)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.next(EmbedResultSet.java:367)
>         at DoubleInsertInto.main(DoubleInsertInto.java:47)
> Caused by: java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to read more data tha
> n was originally stored
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11
> 9)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
>         ... 10 more
> Caused by: java.sql.SQLException: Java exception: ': java.io.EOFException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11
> 9)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
>         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
>         at org.apache.derby.impl.jdbc.Util.javaException(Util.java:244)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
>         ... 8 more
> Caused by: java.io.EOFException
>         at org.apache.derby.iapi.types.SQLBinary.readBinaryLength(SQLBinary.java:350)
>         at org.apache.derby.iapi.types.SQLBinary.readExternalFromArray(SQLBinary.java:328)
>         at org.apache.derby.impl.store.raw.data.StoredPage.readRecordFromArray(StoredPage.java:5568)
>         at org.apache.derby.impl.store.raw.data.StoredPage.restoreRecordFromSlot(StoredPage.java:1497)
>         at org.apache.derby.impl.store.raw.data.BasePage.fetchFromSlot(BasePage.java:459)
>         at org.apache.derby.impl.store.access.conglomerate.GenericScanController.fetchRows(GenericScanController.java:75
> 9)
>         at org.apache.derby.impl.store.access.heap.HeapScan.fetchNextGroup(HeapScan.java:324)
>         at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.reloadArray(BulkTableScanResultSet.java:327)
>         at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.getNextRowCore(BulkTableScanResultSet.java:282)
>         at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(BasicNoPutResultSetImpl.java:460)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:423)
>         ... 2 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (DERBY-3645) Insert into selecting BLOB column twice leads to SQLException: Restore of a serializable or SQLData object of class error selecting from the table

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3645?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden reopened DERBY-3645:
-----------------------------------


reopen for 10.5 back port

> Insert into selecting BLOB column twice leads to SQLException: Restore of a serializable or SQLData object of class error selecting from the table
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3645
>                 URL: https://issues.apache.org/jira/browse/DERBY-3645
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.3.0, 10.4.2.0, 10.5.1.1
>            Reporter: Kathey Marsden
>             Fix For: 10.6.1.0
>
>         Attachments: DoubleInsertInto.java
>
>
> The following code which inserts into a table by selecting a blob column twice from another table, causes SQLException: Restore of a serializable or SQLData object of class error selecting from the table. See attached program DoubleInsertInto for full repro.  Stack trace is below.  Verified back to 10.3 but probably goes back further.
>         s.executeUpdate("CREATE TABLE T_MAIN(" +
>                 "ID INT  GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " +
>                 "V BLOB(590473235) )");
>         String ins1 = "INSERT INTO T_MAIN(V) VALUES (?)";
>         
>         PreparedStatement ps;
>         ps = c.prepareStatement(ins1);
> 	byte[] bytes = new byte[35000];
> 	for (int i = 0; i < 35000; i++)
> 	    bytes[i] = (byte) i ;
> 	ps.setBytes(1, bytes);
>         ps.executeUpdate();
>         ps.close();
> 	s.executeUpdate("CREATE TABLE T_COPY ( V1 BLOB(2M), V2 BLOB(2M))");
> 	Statement stmt = c.createStatement();
> 	stmt.executeUpdate("INSERT INTO T_COPY SELECT  V, V FROM T_MAIN");
> 	ResultSet rs = stmt.executeQuery("SELECT * FROM T_COPY");
> 	rs.next();
> 	String v1 = rs.getString(1);
> 	String v2 = rs.getString(2);
> 	System.out.println("v1:" + v1);
> 	System.out.println("v2:" + v2);
> 	System.out.println("I am done");
> Exception in thread "main" java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to re
> ad more data than was originally stored
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
>         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
>         at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:223)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:398)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
>         at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2125)
>         at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.closeOnTransactionError(EmbedResultSet.java:4320)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:463)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.next(EmbedResultSet.java:367)
>         at DoubleInsertInto.main(DoubleInsertInto.java:47)
> Caused by: java.sql.SQLException: Restore of a serializable or SQLData object of class , attempted to read more data tha
> n was originally stored
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11
> 9)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
>         ... 10 more
> Caused by: java.sql.SQLException: Java exception: ': java.io.EOFException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:11
> 9)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
>         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
>         at org.apache.derby.impl.jdbc.Util.javaException(Util.java:244)
>         at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
>         ... 8 more
> Caused by: java.io.EOFException
>         at org.apache.derby.iapi.types.SQLBinary.readBinaryLength(SQLBinary.java:350)
>         at org.apache.derby.iapi.types.SQLBinary.readExternalFromArray(SQLBinary.java:328)
>         at org.apache.derby.impl.store.raw.data.StoredPage.readRecordFromArray(StoredPage.java:5568)
>         at org.apache.derby.impl.store.raw.data.StoredPage.restoreRecordFromSlot(StoredPage.java:1497)
>         at org.apache.derby.impl.store.raw.data.BasePage.fetchFromSlot(BasePage.java:459)
>         at org.apache.derby.impl.store.access.conglomerate.GenericScanController.fetchRows(GenericScanController.java:75
> 9)
>         at org.apache.derby.impl.store.access.heap.HeapScan.fetchNextGroup(HeapScan.java:324)
>         at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.reloadArray(BulkTableScanResultSet.java:327)
>         at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.getNextRowCore(BulkTableScanResultSet.java:282)
>         at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(BasicNoPutResultSetImpl.java:460)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:423)
>         ... 2 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.