Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

converting InputStream....

 
Ilja Smoli
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Im not really good in streams, so here is my question...
Im serializing an object and puting it to Oracle column of type "Clob":

This works fine

Then I want to get this object from a table and Deserialize it:


Exception is : java.io.StreamCorruptedException: invalid stream header

I tried to printout InputStream and it consist of bytes
So if I understand correctly I need a stream of chars to give to ObjectInputStream so it could deserialize correctly...

If I printout this InputStream with BufferedReader, then it looks like serialized object..
So question is how to get valid Stream for ObjectInputStream?

thx in advance...
 
Joe Ess
Bartender
Posts: 9340
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Every example I've seen uses a BLOB rather than a CLOB. I'm going to toss this question over to the JDBC forum and see if anyone there has any bright ideas.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ilja,
Joe is correct. Bytes are binary data and therefore BLOB (binary large objects) are used.

Databases try to encode CLOBs as character data and can get confused when unencoding them since binary data doesn't map well to characters.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic