• Post Reply Bookmark Topic Watch Topic
  • New Topic

Serialize an object to db2  RSS feed

 
Negin Negin
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am trying to serialize an object into the db2. The column name on my table for the object is type blob.
I do the followings to write to the db:
ByteArrayOutputStream output = new ByteArrayOutputStream();
ObjectOutputStream OutputStream = new
//pc is my object
ObjectOutputStream(output);
OutputStream.writeObject(pc);
byte[] pcByte = output.toByteArray();
I then pass pc Byte to my stored procedure where the datatype of the parameter to pass pc through is blob.


I am having difficulties reading the object back and casting it to its type.

could you help.

Many thanks in advance.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!