File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Storing uploaded files straight into a database

 
ernest fakudze
Ranch Hand
Posts: 216
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi to all,

This has been bugging me for some time now and I finally thought I would come out clean and ask. I am aware that many realational databases can store files such as images directly into them but I don't see this done much.

Let me explain, I work for a web development agency here in the UK and I've worked there for over the past 3 years as a web developer. I have had the pleassure of maintaining hundreds of sites over that period;) Most of the sites are backed by either MySQL or MS SQL Server.

When developers want to upload, say a document as part of a database news article they will simply store the file somewhere on the hard drive and then store a reference to it in a database column. I have never seen a developer storing the file directly into the db. Is this how it's done normally. I'm just curious. The only reason I think people never store files straight into the db is because the files might take up too much space.

Please enlighten me.

Best regards,
Ernest
[ December 30, 2006: Message edited by: ernest fakudze ]
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This very subject has been discussed recently, and several times before that.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33697
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also added it to the FAQ the last time this question was asked.
 
ernest fakudze
Ranch Hand
Posts: 216
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for pointing me in the right directions guys. I forgot to search the forums first.

~Ernest
 
Paul Santa Maria
Ranch Hand
Posts: 236
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Storing a link to the graphics file (instead of inserting the whole file into the database), is:

1. faster
(a disk access, vs a database connection & subsequent data transfer)
2. more efficient
(see above)
3. More portable
(different databases have different syntax for blob's)
4. Easier to code
5. Easier to back up

which is probably why that's the way it's usually done (except for stuff like MS Sharepoint, of course ;-))

IMHO .. PSM
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic