Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 53296 invoked from network); 18 Jul 2009 01:09:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Jul 2009 01:09:32 -0000 Received: (qmail 54610 invoked by uid 500); 18 Jul 2009 01:10:37 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 54527 invoked by uid 500); 18 Jul 2009 01:10:37 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 54519 invoked by uid 99); 18 Jul 2009 01:10:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 18 Jul 2009 01:10:37 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 18 Jul 2009 01:10:35 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id C6612234C044 for ; Fri, 17 Jul 2009 18:10:14 -0700 (PDT) Message-ID: <2056157268.1247879414799.JavaMail.jira@brutus> Date: Fri, 17 Jul 2009 18:10:14 -0700 (PDT) From: "Kathey Marsden (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Created: (DERBY-4315) Attempt to reuse streams in client on insert gives protocol exception and inserts wrong data MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org Attempt to reuse streams in client on insert gives protocol exception and inserts wrong data -------------------------------------------------------------------------------------------- Key: DERBY-4315 URL: https://issues.apache.org/jira/browse/DERBY-4315 Project: Derby Issue Type: Bug Components: JDBC Affects Versions: 10.5.2.0, 10.6.0.0 Reporter: Kathey Marsden If a user attempts to reuse a stream set as a parameter to a prepared statement, the statement execution should fail with SQL State XJ001. Instead client fails with a protocol error and inserts wrong data. See the attached java program ReproReuseStream.java for a reproduction. [C:/kmarsden/repro/reusestream] java ReproReuseStream Insert row 1 Try to insert row 2 with reused streams java.sql.SQLException: Network protocol error: end of stream prematurely reached, parameter #4. Remaining data has been padded with 0x0. at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:96) at org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:358) at org.apache.derby.client.am.PreparedStatement.executeUpdate(PreparedStatement.java:399) at ReproReuseStream.main(ReproReuseStream.java:41) Caused by: org.apache.derby.client.am.SqlException: Network protocol error: end of stream prematurely reached, parameter #4. Remaining data has been padded with 0x0. at org.apache.derby.client.net.Request.writePlainScalarStream(Request.java:490) at org.apache.derby.client.net.Request.writeScalarStream(Request.java:264) at org.apache.derby.client.net.NetStatementRequest.buildEXTDTA(NetStatementRequest.java:951) at org.apache.derby.client.net.NetStatementRequest.writeExecute(NetStatementRequest.java:147) at org.apache.derby.client.net.NetPreparedStatement.writeExecute_(NetPreparedStatement.java:178) at org.apache.derby.client.am.PreparedStatement.writeExecute(PreparedStatement.java:1801) at org.apache.derby.client.am.PreparedStatement.flowExecute(PreparedStatement.java:2031) at org.apache.derby.client.am.PreparedStatement.executeUpdateX(PreparedStatement.java:404) at org.apache.derby.client.am.PreparedStatement.executeUpdate(PreparedStatement.java:390) ... 1 more Go ahead and commit so we can see the wrong data. ID |MNAME |MVALUE |BYTEDATA |CHARDATA ------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------ -------------------------------------------------- 1 |mname |0 |636363636363636363636363636363636363636363636363636363636363636363636363636363636363636 3636363636363636363636363636363636363636&|cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc ccccccccccccccccccccccccccccccccccccccccccccccccc& 2 |mname |0 |000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000&| & To workaround the issue users should not attempt to reuse streams but we should give a better message and not insert wrong data. The code was extracted from StreamingColumnTest testDerby500 but the commits were removed. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.