db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sunitha Kambhampati (JIRA)" <derby-...@db.apache.org>
Subject [jira] Updated: (DERBY-562) Derby incorrectly throws Exception when streaming to BLOB field
Date Wed, 21 Sep 2005 03:24:28 GMT
     [ http://issues.apache.org/jira/browse/DERBY-562?page=all ]

Sunitha Kambhampati updated DERBY-562:
--------------------------------------

    Attachment: Derby562.diff.txt

This patch
-  changes the error message thrown when the stream is either less or greater than the requested
length to
'Input stream did not have exact amount of data as the requested length.'
-  enhances the characterStreams.out test, to print out  the nested sql exceptions to ensure
that the proper error message is returned.
-  updates to the master files.

Ran derbyall with no failures on jdk1.4.2/windows.

svn stat
M      java\engine\org\apache\derby\impl\jdbc\RawToBinaryFormatStream.java
M      java\engine\org\apache\derby\impl\jdbc\ReaderToUTF8Stream.java
M      java\engine\org\apache\derby\iapi\reference\SQLState.java
M      java\engine\org\apache\derby\loc\messages_en.properties
M      java\testing\org\apache\derbyTesting\functionTests\tests\jdbcapi\characterStreams.java
M      java\testing\org\apache\derbyTesting\functionTests\master\characterStreams.out
M      java\testing\org\apache\derbyTesting\functionTests\master\resultsetStream.out

I verified that we are testing for these two error cases (ie stream has less or more data
than requested length),  for  the following supported stream related api  - setCharacterStream,
setAsciiStream, setBinaryStream on PreparedStatement.     Derby does not support setUnicodeStream
api that is deprecated in jdbc 3.0.

Can someone please review it and commit it.  Thanks.

I would like this patch to also be ported to 10.1. I'll submit the merge command once this
gets committed on trunk.

> 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
>     Versions: 10.1.1.0
>     Reporter: Holger Rehn
>  Attachments: Derby562.diff.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


Mime
View raw message