wood burning stoves 2.0*
The moose likes JDBC and the fly likes Storing files in RDBMS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Storing files in RDBMS" Watch "Storing files in RDBMS" New topic
Author

Storing files in RDBMS

Sean Casey
Ranch Hand

Joined: Dec 16, 2000
Posts: 625
Hi,
This may be a basic question. Is there any way to store files as a whole in databases? Or can I just store the information stored in the files? I've got MySQL running and I want to implement a simple message board using servlets. I figured I could save each message as an html file and then store it in the database. Alternatively, I could store the files data and then convert it back to html at the other end? Any suggestions or resources would be greatly appreciated.
Thanks,
Sean
Robert Brunner
Ranch Hand

Joined: Jul 18, 2001
Posts: 49
Store the user responses as a String, or better yet a clob, and then convert it back to HTML as you need.
rostom aghanian
Greenhorn

Joined: Aug 10, 2001
Posts: 2
Storing the whole html file in the database is a BAD BAD idea. All you need to do is to store the text that the user entered. Then build html/jsp/asp pages seperately which will display this data.
This is so that your presentation is seperated from your data. If you store the whole html file, not only are you taking up an unnecessary amount of space in the database, but you will run into difficulties down the road if you decide to change the look of your web site (i.e. all entries in the database will have to be touched).

Originally posted by Sean Casey:
Hi,
This may be a basic question. Is there any way to store files as a whole in databases? Or can I just store the information stored in the files? I've got MySQL running and I want to implement a simple message board using servlets. I figured I could save each message as an html file and then store it in the database. Alternatively, I could store the files data and then convert it back to html at the other end? Any suggestions or resources would be greatly appreciated.
Thanks,
Sean


------------------
rostom


rostom
 
Don't get me started about those stupid light bulbs.
 
subject: Storing files in RDBMS
 
Similar Threads
Storage and automation
Insert Image/jpg files into MS Database
How to plan large content display?
Dealing with ASCII files in a swing application
To CLOB or BLOB?