[ 
https://issues.apache.org/jira/browse/DERBY-6214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13678500#comment-13678500
 ] 

Mamta A. Satoor edited comment on DERBY-6214 at 6/11/13 8:00 PM:
-----------------------------------------------------------------

Attaching a patch where setObject will now behave same as setString when 
dealing with smaller strings(length 10922 characters and smaller) and modifying 
more than one row through the UPDATE sql. Basically setObject(int, Object, 
Types.CLOB) will check if it is dealing with String and if if it is small 
enough, then it will get on the wire to the server as String. For longer 
strings, we still will use a stream. The stream case still runs into exception 
when we update more than one row. Would appreciate any feedback. One thing to 
note in the patch is the code touched in CrossConverters is also used by 
ResultSet.updateXXX and ResultSet.getXXX calls. Those methods don't need this 
special handling of String and that is why a boolean parameter has been 
introduced to differentiate the call coming from PreparedStatement.setXXX vs 
the ResultSet.updateXXX and ResultSet.getXXX.
                
      was (Author: mamtas):
    Attaching a patch where setObject will now behave same as setString when 
dealing with smaller strings(length 10922 characters and smaller) and modifying 
more than one row through the UPDATE sql. Basically setObject(int, Object, 
Types.CLOB) will check if it is dealing with String and if if it is small 
enough, then it will get on the wire to the server as String. For longer 
strings, we still will use a stream. The stream case still runs into exception 
when we update more than one row. Would appreciate any feedback. One thing to 
note in the patch is the code touched in CrossConverters is also used by 
updateXXX and getXXX calls on the PreparedStatement. Those methods don't need 
this special handling of String and that is why a boolean parameter has been 
introduced to differentiate the call coming from setXXX vs the updateXXX and 
getXXX.
                  
> PreparedStatement.setObject(int, Object, Types.CLOB) fail with DerbyNet
> -----------------------------------------------------------------------
>
>                 Key: DERBY-6214
>                 URL: https://issues.apache.org/jira/browse/DERBY-6214
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.8.3.0, 10.9.1.0
>            Reporter: Rong Qu
>            Assignee: Mamta A. Satoor
>         Attachments: Derby6214.java, DERBY6214_patch1_diff.txt, 
> DERBY6214_patch1_stat.txt, Derby6214_setup.sql, Derby6214_ver2.java, 
> derby.log, DerbyNet_client_test.sql
>
>
> 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

--
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