Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 17209 invoked from network); 17 Aug 2005 00:12:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 17 Aug 2005 00:12:59 -0000 Received: (qmail 35654 invoked by uid 500); 17 Aug 2005 00:12:58 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 35612 invoked by uid 500); 17 Aug 2005 00:12:57 -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: "Derby Development" Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 35598 invoked by uid 99); 17 Aug 2005 00:12:57 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=SPF_FAIL X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Aug 2005 17:12:57 -0700 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id 01420E0 for ; Wed, 17 Aug 2005 02:12:56 +0200 (CEST) Message-ID: <1993026881.1124237576003.JavaMail.jira@ajax.apache.org> Date: Wed, 17 Aug 2005 02:12:56 +0200 (CEST) From: "Mike Matrigali (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Updated: (DERBY-500) Update/Select failure when BLOB/CLOB fields updated in several rows by PreparedStatement using setBinaryStream and setCharacterStream In-Reply-To: <519594564.1123576715525.JavaMail.jira@ajax.apache.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/DERBY-500?page=all ] Mike Matrigali updated DERBY-500: --------------------------------- Component: JDBC > Update/Select failure when BLOB/CLOB fields updated in several rows by PreparedStatement using setBinaryStream and setCharacterStream > ------------------------------------------------------------------------------------------------------------------------------------- > > Key: DERBY-500 > URL: http://issues.apache.org/jira/browse/DERBY-500 > Project: Derby > Type: Bug > Components: JDBC > Versions: 10.1.1.0 > Environment: Windows 2000, java SDK 1.4 > Reporter: Peter Kovgan > > I have table contained BLOB and CLOB fields: > Create table string is: > private static final String CREATE = "CREATE TABLE ta (" + > "ta_id INTEGER NOT NULL," + > "mname VARCHAR( 254 ) NOT NULL," + > "mvalue INT NOT NULL," + > "mdate DATE NOT NULL," + > "bytedata BLOB NOT NULL," + > "chardata CLOB NOT NULL," + > "PRIMARY KEY ( ta_id ))"; > Then I insert 2000 rows in the table. > Then I update all 2000 rows by command: > private static final String UPDATE = "UPDATE ta " + > "SET bytedata=? ,chardata=? " + > "WHERE mvalue=?"; > /**create blob and clob arrays**/ > int len1 = 10000;//for blob length data > int len2 = 15000;//for clob length data > byte buf [] = new byte[len1]; > for(int i=0;i buf [i] = (byte)45; > } > ByteArrayInputStream bais = new ByteArrayInputStream(buf); > > char[] bufc = new char[len2]; > for (int i = 0; i < bufc.length; i++) { > bufc[i] = (char)'b'; > } > CharArrayReader car = new CharArrayReader(bufc); > /***/ > PreparedStatement pstmt = connection.prepareStatement(UPDATE); > pstmt.setBinaryStream(1,bais, len1); > pstmt.setCharacterStream(2,car, len2); > pstmt.setInt(3,5000); > int updated = pstmt.executeUpdate(); > pstmt.close(); > System.out.printlen("updated ="+updated ); > all 2000 rows updated , because I receive output : updated =2000 > But If I run select (SELECT bytedata ,chardata FROM ta) after update, select failed with error: > ERROR XSDA7: Restore of a serializable or SQLData object of class , attempted to > read more data than was originally stored > at org.apache.derby.iapi.error.StandardException.newException(StandardEx > ception.java) > at org.apache.derby.impl.store.raw.data.StoredPage.readRecordFromArray(S > toredPage.java) > at org.apache.derby.impl.store.raw.data.StoredPage.restoreRecordFromSlot > (StoredPage.java) > at org.apache.derby.impl.store.raw.data.BasePage.fetchFromSlot(BasePage. > java) > at org.apache.derby.impl.store.access.conglomerate.GenericScanController > .fetchRows(GenericScanController.java) > at org.apache.derby.impl.store.access.heap.HeapScan.fetchNextGroup(HeapS > can.java) > at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.reloadArray( > BulkTableScanResultSet.java) > at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.getNextRowCo > re(BulkTableScanResultSet.java) > at org.apache.derby.impl.sql.execute.NestedLoopJoinResultSet.getNextRowC > ore(NestedLoopJoinResultSet.java) > at org.apache.derby.impl.sql.execute.NestedLoopLeftOuterJoinResultSet.ge > tNextRowCore(NestedLoopLeftOuterJoinResultSet.java) > at org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRow > Core(ProjectRestrictResultSet.java) > at org.apache.derby.impl.sql.execute.SortResultSet.getRowFromResultSet(S > ortResultSet.java) > at org.apache.derby.impl.sql.execute.SortResultSet.getNextRowFromRS(Sort > ResultSet.java) > at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResult > Set.java) > at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSe > t.java) > at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open(BasicN > oPutResultSetImpl.java) > at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPre > paredStatement.java) > at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedState > ment.java) > at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Em > bedPreparedStatement.java) > at org.apache.derby.impl.jdbc.EmbedPreparedStatement.execute(EmbedPrepar > edStatement.java) > at com.beep_beep.dbtest.complex.Benchmark.testSelect(Unknown Source) > at com.beep_beep.dbtest.complex.Benchmark.executeSimplestBigTable(Unknown Sour > ce) > at com.beep_beep.dbtest.complex.Benchmark.testBigTable(Unknown Source) > at com.beep_beep.dbtest.complex.Benchmark.executeDegradationBenchmark(Unknown > Source) > at com.beep_beep.dbtest.complex.Benchmark.main(Unknown Source) > From the stack trace and from console I see that Update passed, but error was raised in Select after Update. > When I try the same update, but with difference(I changed WHERE clause, causing update only 1 row): > private static final String UPDATE = "UPDATE ta " + > "SET bytedata=? ,chardata=? " + > "WHERE mname=?"; > PreparedStatement pstmt = connection.prepareStatement(UPDATE); > pstmt.setBinaryStream(1,bais, len1); > pstmt.setCharacterStream(2,car, len2); > pstmt.setInt(3,"PETER"); > int updated = pstmt.executeUpdate(); > pstmt.close(); > System.out.printlen("updated ="+updated ); > Only 1 row updated , because I receive output : updated =1 > In this case I have NO errors in select(the same as previous) . > My assumption: > It seems that Update receives ByteArrayInputStream and updates correctly only 1 row, then all rows updated by some > incorrect value(may be because ByteArrayInputStream reached its end in first update), causing select failure. > I tested PointBase by the same test and PointBase passed this stage without errors, no matter how many rows was updated. > So I think it is a bug. > Thank you. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira