File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Can I store objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Can I store objects" Watch "Can I store objects" New topic
Author

Can I store objects

minnu chand
Greenhorn

Joined: Feb 06, 2001
Posts: 5
Can I store objects in the database using JDBC
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
You could try serializing the object and storing it as a blob.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Brett Spell
Ranch Hand

Joined: Feb 24, 2001
Posts: 96
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).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can I store objects