Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Storing files in RDBMS

 
Sean Casey
Ranch Hand
Posts: 625
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic