db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dinesh Bajaj <dinesh.ba...@ymail.com>
Subject Re: Problem storing an image in a Blob field in Java DB.
Date Fri, 12 Feb 2010 05:07:43 GMT

I am much disappointed that I have not got a single reply to my post. Surely, what I am trying
to accomplish is a very simple task. Aren't Blob fields supposed to store binary objects like
images; then, why the database can't perform this simple task?

-Dinesh

--- On Wed, 10/2/10, Dinesh Bajaj <dinesh.bajaj@ymail.com> wrote:

From: Dinesh Bajaj <dinesh.bajaj@ymail.com>
Subject: Problem storing an image in a Blob field in Java DB.
To: derby-user@db.apache.org
Date: Wednesday, 10 February, 2010, 11:14 PM

Hi All,

I am using Java DB 10.5, and am experiencing problem in storing an image in a Blob field.
I am using the below command to insert the image:

preparedStatement.setBinaryStream(5, inputStream, file.length());

The Derby throws the following exception on using the above-mentioned command:

Error code : 0
SQL State = XJ001
Message = Java exception: 'Input stream did not have exact amount of data as the requested
length.: org.apache.derby.iapi.services.io.DerbyIOException'.

If I use the method variant of setBinaryStream that doesn't take the 3rd argement, then the
command executes without any error, but perhaps no date is stored in the database, as when
the data is retrieved in a Blob variable, its length is reported to be zero.

Thanks for any help that you can
 offer.

Regards,
Dinesh





       
The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.


      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/
Mime
View raw message