Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-6214

PreparedStatement.setObject(int, Object, Types.CLOB) fail with DerbyNet

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 10.8.3.0, 10.9.1.0
    • None
    • SQL
    • None
    • Normal
    • Repro attached, Workaround attached

    Description

      The issue is specific to the DerbyNet client driver, and doesn't seem to occur using embedded Derby.

      "PreparedStatement.setObject(int, Object, Types.CLOB)". It seems to be a problem updating a CLOB column with a parameterized value using the DerbyNet client driver, and if the update SQL ends up updating more than one row. I attached a simple test case that just uses JDBC to reproduce the error. The exception looks like this:

      org.apache.derby.client.am.BatchUpdateException: Non-atomic batch failure. The batch was submitted, but at least one exception occurred on an individual member of the batch. Use getNextException() to retrieve the exceptions for specific batched elements.
      at org.apache.derby.client.am.Agent.endBatchedReadChain(Unknown Source)
      at org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(Unknown Source)
      at org.apache.derby.client.am.PreparedStatement.executeBatchX(Unknown Source)
      at org.apache.derby.client.am.PreparedStatement.executeBatch(Unknown Source)
      ...
      Caused by: org.apache.derby.client.am.SqlException: Error for batch element #0: An unexpected exception was thrown
      at org.apache.derby.client.am.Statement.completeExecute(Unknown Source)
      at org.apache.derby.client.net.NetStatementReply.parseEXCSQLSTTreply(Unknown Source)
      at org.apache.derby.client.net.NetStatementReply.readExecute(Unknown Source)
      at org.apache.derby.client.net.StatementReply.readExecute(Unknown Source)
      at org.apache.derby.client.net.NetPreparedStatement.readExecute_(Unknown Source)
      at org.apache.derby.client.am.PreparedStatement.readExecute(Unknown Source)
      ... 4 more
      Caused by: org.apache.derby.client.am.SqlException: Error for batch element #0: Java exception: 'Stream has already been read and end-of-file reached and cannot be re-used.: java.io.EOFException'.
      at org.apache.derby.client.am.SqlException.<init>(Unknown Source)
      at org.apache.derby.client.am.SqlException.<init>(Unknown Source)
      ... 10 more

      Attachments

        1. DerbyNet_client_test.sql
          2 kB
          Rong Qu
        2. Derby6214_setup.sql
          0.7 kB
          Katherine Marsden
        3. Derby6214.java
          1 kB
          Katherine Marsden
        4. derby.log
          22 kB
          Katherine Marsden
        5. Derby6214_ver2.java
          3 kB
          Mamta A. Satoor
        6. DERBY6214_patch1_diff.txt
          6 kB
          Mamta A. Satoor
        7. DERBY6214_patch1_stat.txt
          0.2 kB
          Mamta A. Satoor
        8. DERBY6214_patch2_diff.txt
          30 kB
          Mamta A. Satoor
        9. DERBY6214_patch3_diff.txt
          29 kB
          Mamta A. Satoor
        10. DERBY6214_patch3_stat.txt
          0.4 kB
          Mamta A. Satoor

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rqu Rong Qu
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: