db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kathey Marsden (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DERBY-6214) PreparedStatement.setObject(int, Object, Types.CLOB) fail with DerbyNet
Date Mon, 06 May 2013 18:36:16 GMT

     [ https://issues.apache.org/jira/browse/DERBY-6214?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Kathey Marsden updated DERBY-6214:
----------------------------------

    Attachment: derby.log
                Derby6214.java
                Derby6214_setup.sql

Here is a revised reproduction which separates out the setup sql from the java. 

Commented out in the java program is a workaround which is to use setString rather than setObject.

 // Work around. setString works.
	    //ps.setString(1,"Modified CLOB value 2!!!!!!!!!!"); //2005);

To run:

java org.apace.derby.drda.NetworkServerControl start &

java org.apache.derby.tools.ij Derby6214_setup.sql

 $java Derby6214
Exception in thread "main" org.apache.derby.client.am.BatchUpdateException: Non-atomic batch
failure.  The batch was sub
mitted, 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(Agent.java:270)
        at org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(PreparedStatement.java:2359)
        at org.apache.derby.client.am.PreparedStatement.executeBatchX(PreparedStatement.java:2192)
        at org.apache.derby.client.am.PreparedStatement.executeBatch(PreparedStatement.java:1651)
        at Derby6214.main(Derby6214.java:29)
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(Statement.java:1604)
        at org.apache.derby.client.net.NetStatementReply.parseEXCSQLSTTreply(NetStatementReply.java:322)
        at org.apache.derby.client.net.NetStatementReply.readExecute(NetStatementReply.java:71)
        at org.apache.derby.client.net.StatementReply.readExecute(StatementReply.java:55)
        at org.apache.derby.client.net.NetPreparedStatement.readExecute_(NetPreparedStatement.java:185)
        at org.apache.derby.client.am.PreparedStatement.readExecute(PreparedStatement.java:1810)
        at org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(PreparedStatement.java:2325)
        ... 3 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>(SqlException.java:292)
        at org.apache.derby.client.am.SqlException.<init>(SqlException.java:259)
        ... 10 more
~/repro/derby-6214 $

The full exception from the derby.log is:



Mon May 06 11:30:40 PDT 2013 Thread[DRDAConnThread_11,5,main] (XID = 168), (SESSIONID = 3),
(DATABASE = ClobTest), (DRDAID = ????????.????-653020578103681136{2}), Failed Statement is:
UPDATE Test3 SET C16 = ?, S05 = ?, I06 = ?, I07 = I07 + 1 WHERE S02 IN (?, ?) with 5 parameters
begin parameter #1: CLOB(org.apache.derby.iapi.types.ReaderToUTF8Stream@de907da4) :end parameter
begin parameter #2: GGGGGGGG :end parameter begin parameter #3: 4002 :end parameter begin
parameter #4: AAAAA :end parameter begin parameter #5: EEEEE :end parameter 
ERROR XSDA4: An unexpected exception was thrown
	at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:279)
	at org.apache.derby.impl.store.raw.data.UpdateOperation.<init>(UpdateOperation.java:110)
	at org.apache.derby.impl.store.raw.data.LoggableActions.actionUpdate(LoggableActions.java:80)
	at org.apache.derby.impl.store.raw.data.StoredPage.doUpdateAtSlot(StoredPage.java:8703)
	at org.apache.derby.impl.store.raw.data.BasePage.updateAtSlot(BasePage.java:1064)
	at org.apache.derby.impl.store.access.conglomerate.GenericConglomerateController.replace(GenericConglomerateController.java:486)
	at org.apache.derby.impl.sql.execute.RowChangerImpl.updateRow(RowChangerImpl.java:523)
	at org.apache.derby.impl.sql.execute.UpdateResultSet.collectAffectedRows(UpdateResultSet.java:568)
	at org.apache.derby.impl.sql.execute.UpdateResultSet.open(UpdateResultSet.java:263)
	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:438)
	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:319)
	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1242)
	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1692)
	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.execute(EmbedPreparedStatement.java:1347)
	at org.apache.derby.impl.drda.DRDAStatement.execute(DRDAStatement.java:706)
	at org.apache.derby.impl.drda.DRDAConnThread.parseEXCSQLSTTobjects(DRDAConnThread.java:4332)
	at org.apache.derby.impl.drda.DRDAConnThread.parseEXCSQLSTT(DRDAConnThread.java:4149)
	at org.apache.derby.impl.drda.DRDAConnThread.processCommands(DRDAConnThread.java:1037)
	at org.apache.derby.impl.drda.DRDAConnThread.run(DRDAConnThread.java:295)
Caused by: java.io.EOFException: Stream has already been read and end-of-file reached and
cannot be re-used.
	at org.apache.derby.iapi.types.ReaderToUTF8Stream.read(ReaderToUTF8Stream.java:254)
	at org.apache.derby.impl.store.raw.data.MemByteHolder.write(MemByteHolder.java:146)
	at org.apache.derby.impl.store.raw.data.RememberBytesInputStream.fillBuf(RememberBytesInputStream.java:135)
	at org.apache.derby.impl.store.raw.data.StoredPage.logColumn(StoredPage.java:6238)
	at org.apache.derby.impl.store.raw.data.StoredPage.logRow(StoredPage.java:4013)
	at org.apache.derby.impl.store.raw.data.UpdateOperation.writeOptionalDataToBuffer(UpdateOperation.java:255)
	at org.apache.derby.impl.store.raw.data.UpdateOperation.<init>(UpdateOperation.java:106)
	... 17 more
============= begin nested exception, level (1) ===========
java.io.EOFException: Stream has already been read and end-of-file reached and cannot be re-used.
	at org.apache.derby.iapi.types.ReaderToUTF8Stream.read(ReaderToUTF8Stream.java:254)
	at org.apache.derby.impl.store.raw.data.MemByteHolder.write(MemByteHolder.java:146)
	at org.apache.derby.impl.store.raw.data.RememberBytesInputStream.fillBuf(RememberBytesInputStream.java:135)
	at org.apache.derby.impl.store.raw.data.StoredPage.logColumn(StoredPage.java:6238)
	at org.apache.derby.impl.store.raw.data.StoredPage.logRow(StoredPage.java:4013)
	at org.apache.derby.impl.store.raw.data.UpdateOperation.writeOptionalDataToBuffer(UpdateOperation.java:255)
	at org.apache.derby.impl.store.raw.data.UpdateOperation.<init>(UpdateOperation.java:106)
	at org.apache.derby.impl.store.raw.data.LoggableActions.actionUpdate(LoggableActions.java:80)
	at org.apache.derby.impl.store.raw.data.StoredPage.doUpdateAtSlot(StoredPage.java:8703)
	at org.apache.derby.impl.store.raw.data.BasePage.updateAtSlot(BasePage.java:1064)
	at org.apache.derby.impl.store.access.conglomerate.GenericConglomerateController.replace(GenericConglomerateController.java:486)
	at org.apache.derby.impl.sql.execute.RowChangerImpl.updateRow(RowChangerImpl.java:523)
	at org.apache.derby.impl.sql.execute.UpdateResultSet.collectAffectedRows(UpdateResultSet.java:568)
	at org.apache.derby.impl.sql.execute.UpdateResultSet.open(UpdateResultSet.java:263)
	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:438)
	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:319)
	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1242)
	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1692)
	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.execute(EmbedPreparedStatement.java:1347)
	at org.apache.derby.impl.drda.DRDAStatement.execute(DRDAStatement.java:706)
	at org.apache.derby.impl.drda.DRDAConnThread.parseEXCSQLSTTobjects(DRDAConnThread.java:4332)
	at org.apache.derby.impl.drda.DRDAConnThread.parseEXCSQLSTT(DRDAConnThread.java:4149)
	at org.apache.derby.impl.drda.DRDAConnThread.processCommands(DRDAConnThread.java:1037)
	at org.apache.derby.impl.drda.DRDAConnThread.run(DRDAConnThread.java:295)
============= end nested exception, level (1) ===========
Cleanup action complete























































                
> 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
>            Priority: Critical
>         Attachments: Derby6214.java, Derby6214_setup.sql, 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

Mime
View raw message