• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can I store objects

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can I store objects in the database using JDBC
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could try serializing the object and storing it as a blob.
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's true, although if your database doesn't support BLOBs, you can also use other "binary" types such as Oracle's RAW and LONGRAW. Even if the database does support BLOBs, I'm not sure that you gain anything by using them, since their main advantage over (say) a LONGRAW is that a BLOB allows you to update or retrieve only a portion of the data, and in the case of a serialized object instance, I can't think of any situation where you'd want to do so. Besides, if your database supports BLOB (which is a SQL3 data type), there's a good chance that it also supports structured data types (also defined in SQL3), and you'd probably be better off using one of those. There's some good information on SQL3 types at:
http://java.sun.com/docs/books/tutorial/jdbc/jdbc2dot0/sql3.html
Alternatively, you could pick up a copy of my book, which covers these topics in a bit more detail.
------------------
Brett Spell
Author, Professional Java Programming
[This message has been edited by Brett Spell (edited February 24, 2001).]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic