| 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
|
|
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
|
 |
 |
|
|
subject: Storing a Java Object in Oracle [code] Blob [/code]
|
|
|