I always serialize the object to a byte and then use setBinaryStream(),
byte b = ... // serialize arbitrary object to byte
ByteArrayInputStream ins = new ByteArrayInputStream(b);
ps.setBinaryStream(psParamIndex, ins, b.length);
I've found this to be reliable. FYI Problems with using setObject ()
with blobs is not
specific to Derby. I've had to use the above with MySQL and Oracle as
Suavi Ali Demir wrote:
How about you first serialize your object into a
byte and then do a setBytes() ? And then to read it
back you can do getBytes() and then deserialize from
that byte. Would that work?
--- Mithun Ruikar <firstname.lastname@example.org> wrote:
Hello there ,
I have problem while setting Blob value to table
created in derby.
I had created : a datasource by parameter
and then created new table in it with one column
with Datatype as Blob.
But when I tried to setObject value to this column (
by serializable object awt.color)
It gave derby exception : trying to get Blob value
from Object type.
setBlob also didnt work with error saying : this
method is undefined for (int , Object)
and if i typecast it to (int , (Blob) Object) : I
please tell me how to set this value to blob field
Do you Yahoo!?
Yahoo! Search presents - Jib Jab's 'Second Term'