Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 11649 invoked from network); 7 Oct 2005 00:11:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Oct 2005 00:11:12 -0000 Received: (qmail 59478 invoked by uid 500); 7 Oct 2005 00:11:11 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 59441 invoked by uid 500); 7 Oct 2005 00:11:11 -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 59430 invoked by uid 99); 7 Oct 2005 00:11:11 -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; Thu, 06 Oct 2005 17:11:09 -0700 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id 8B20C21F for ; Fri, 7 Oct 2005 02:10:48 +0200 (CEST) Message-ID: <505739172.1128643848567.JavaMail.jira@ajax.apache.org> Date: Fri, 7 Oct 2005 02:10:48 +0200 (CEST) From: "Kathey Marsden (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-562) Derby incorrectly throws Exception when streaming to BLOB field In-Reply-To: <672715523.1126607934399.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-562?page=comments#action_12331542 ] Kathey Marsden commented on DERBY-562: -------------------------------------- Committed this to 10.1 Date: Thu Oct 6 16:52:27 2005 New Revision: 306964 URL: http://svn.apache.org/viewcvs?rev=306964&view=rev > Derby incorrectly throws Exception when streaming to BLOB field > --------------------------------------------------------------- > > Key: DERBY-562 > URL: http://issues.apache.org/jira/browse/DERBY-562 > Project: Derby > Type: Bug > Components: JDBC > Versions: 10.1.1.0, 10.0.2.0, 10.0.2.1, 10.2.0.0, 10.1.2.0, 10.1.1.1, 10.0.2.2 > Environment: All > Reporter: Holger Rehn > Assignee: Sunitha Kambhampati > Fix For: 10.2.0.0, 10.1.2.0 > Attachments: Derby562.diff.txt, Derby562.stat.txt > > Derby incorrectly throws an Exception when streaming to a BLOB in case the used InputStream actually could provide more data than I want to write to the BLOB field. > PreparedStatement statement = connection.prepareStatement( "insert into FOO(ID,DATA) values(?, ?)" ); > statement.setLong( 1, someValue ); > statement.setBinaryStream( 2, someInputStream, amountOfData ); // amountOfData < amount of data readable from someInputStream > statement.executeUpdate(); > executeUpdate() throws an SQLException with detail message: "Input stream held less data than requested length.: java.io.IOException" > In my case this was first caused by writing an internal buffer (byte[]) to the data base through a ByteArrayInputStream while not limiting the ByteArrayInputStream to the useful data within the buffer but setting amountOfData to the number of useful bytes. So the 2 problems are: > 1. the error text is definitly incorrect since I provide more data than neccessary, not less > 2. in my opinion this shouldn't throw an exception at all (I checked against 4 other DBMS, all of them worked as intended) -- 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