• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Bear Bibeault
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Jj Roberts

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

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you tell me how to store and Retrieve a Java Object using a Oracle ???
 
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
author & internet detective
Posts: 40286
819
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter,
Thanks for bringing it back to the forums!
 
I don't always make ads but when I do they're tiny
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic