• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can I store objects

 
minnu chand
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I store objects in the database using JDBC
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could try serializing the object and storing it as a blob.
 
Brett Spell
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • 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).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic