Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EOF Exception reading Blobs

Status
Not open for further replies.

sjakiePP

Programmer
Apr 6, 2004
104
NL
Hello,

In my application I get an EOF Exceptoin when I try to read a Blob. Here's the code fragment:

Code:
Blob blob = null;
ObjectInputStream oin = null;
Object object1 = null;
java.rmi.MarshalledObject object2 = null;
Object object3 = null;
object1 = oin.readObject(); //eof exception
oin.close();
object2 = (java.rmi.MarshalledObject) object1;
object3 = object2.get();

The size of the blobs varies around 600. Most of the times this code works.

What is causing this exception to occur? Could it be a problem with the database? The blobs are not stored proberly or is there a maximum amout of data that can be read with read object?

Thanks in advance
Sjakie

---------------------------------------------
Yes, the world is full of strange people.
 
I'm not experienced in blobs, rmi and serialisation.
But when oin is null:
[java]ObjectInputStream oin = null;
Object object1 = null;
object1 = oin.readObject(); //eof exception[/java]
how shall it be possible to call readObject () for it?
I'm surprised not to see a NullPointer, but eof-Exception.

seeking a job as java-programmer in Berlin:
 
Sorry, copy and past error on my side.

Code:
Blob blob = null;
ObjectInputStream oin = null;
Object object1 = null;
java.rmi.MarshalledObject object2 = null;
Object object3 = null;

blob = rs.getBlob(12); //from resultset
oin = new ObjectInputStream(blob.getBinaryStream());
object1 = oin.readObject(); //eof exception

oin.close();

object2 = (java.rmi.MarshalledObject) object1;
object3 = object2.get();

---------------------------------------------
Yes, the world is full of strange people.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top