Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Deserialization of BLOB returning NULL  RSS feed

 
Dave Schick
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm storing a serialized object graph on a DB2 table into a column of type BLOB. I can successfully retrieve this column into java as a byte[]. But when I try to deserialize it, it comes back NULL. If I take DB2 out of the picture (ie, run a test where I serialize the object graph then turn around and deserialize it) - it works fine.

barr = (byte[])ngrfRequestWipDao.read(ngrfRequestWipTO);
// Deserialize object graph
ObjectInputStream in = new ObjectInputStream(
new ByteArrayInputStream(barr));
// Deserialize the object
mainRequest = (MainRequestIface) in.readObject();

...mainRequest is NULL at this point.

Any insight you can provide would be greatly appreciated. Thanks!
 
Rob Spoor
Sheriff
Posts: 21047
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like the byte[] contains the serialized value for null. My guess is the picture isn't stored properly in the database.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!