• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Storing uploaded files straight into a database

 
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This very subject has been discussed recently, and several times before that.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for pointing me in the right directions guys. I forgot to search the forums first.

~Ernest
 
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic