aspose file tools
The moose likes JDBC and the fly likes Storing a Java Object in Oracle [code] Blob [/code] Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Storing a Java Object in Oracle [code] Blob [/code]" Watch "Storing a Java Object in Oracle [code] Blob [/code]" New topic
Author

Storing a Java Object in Oracle [code] Blob [/code]

Sri Ram
Greenhorn

Joined: Feb 13, 2006
Posts: 20
Can you tell me how to store and Retrieve a Java Object using a Oracle ???


Sriram<br />SCJP<br />SCWCD
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Typically, you might serialise to a ByteArrayOutputStream then write the byte array to the BLOB. To read, get the byte array from the BLOB then deserialise from a ByteArrayInputStream based on that array.

If you don't know how to serialise/deserialise to/from streams, read up on Java Serialisation, independent of databases.

As a possible optimisation, note that Blob objects have built-in InputStream and OutputStream functionality, from Java 1.4 onwards.


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.<br /> <br />#:^P
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Original Poster sent me a private message asking for code for this. UseTheForumNotEmail

No need for me to go writing example code. Sun's own ought to suffice. See Sun's BLOB example code.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26195
    
  66

Peter,
Thanks for bringing it back to the forums!


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Storing a Java Object in Oracle [code] Blob [/code]
 
Similar Threads
java.io.ioException
Create BLOB Object
BLOB data type
Oracle function using Java to return Blob is zero size
inserting images into an oracle database