• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Deserialization of BLOB returning NULL

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic