Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > General > Database Concepts & Design > How to store photographs

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-03-03, 04:42
forrestyuan forrestyuan is offline
Registered User
 
Join Date: Apr 2003
Location: Nanjing, China
Posts: 5
Question How to store photographs

I have two options:

1. Store the photographs in a blob column.
2. Save each photograph in a file, and store the file name in a column.

Which one is better?
Reply With Quote
  #2 (permalink)  
Old 06-03-03, 06:47
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 4,874
Re: How to store photographs

Quote:
Originally posted by forrestyuan
I have two options:

1. Store the photographs in a blob column.
2. Save each photograph in a file, and store the file name in a column.

Which one is better?
From a logical viewpoint, I'd prefer to have the data in the database along with all the other data. That way it is protected and backed up the same way as all the other data.

From a technical viewpoint, I don't know the pros and cons.
__________________
Tony Andrews
http://tonyandrews.blogspot.com
Reply With Quote
  #3 (permalink)  
Old 06-09-03, 16:36
sco08y sco08y is offline
Registered User
 
Join Date: Oct 2002
Location: Fort Polk, LA
Posts: 500
Re: How to store photographs

Quote:
Originally posted by forrestyuan
I have two options:

1. Store the photographs in a blob column.
2. Save each photograph in a file, and store the file name in a column.

Which one is better?

I've done an application that stored user files in the file system.

Writing code to sift through directory listings is just a pain. Writing extra code to do the backups is, again, a pain. The files will inevitably fall out of synch with your tables, more code to clean that up. You can run into conflicts with poorly designed file systems if you try to put them all into one huge directory, and coming up with schemes to store them in multiply nested directories is a pain. You need to worry about setting permissions on all those files, more configuration headaches, especially with Windows. You have to special case your mechanism to handle files. If you want to be network transparent, you have to connect via file sharing, which means more configuration.

Is that enough work to discourage you from this? Are there any advantages...

One sort of possibility: if you're running a virus scanner, you can have it check uploaded files automatically. That might be sort of useful, except that there's no simple way of getting that information back to the user in a timely manner.

If your DBMS is using raw device files, it shouldn't have any speed disadvantage. Even if it's not, loading a file all at once is still pretty efficient.

If you have to do processing on the file, you'll have to copy it from the DBMS to a file and back, which is two extra passes.

It's *still* so much easier in terms of logistics...
Reply With Quote
  #4 (permalink)  
Old 06-24-03, 04:05
KillaCrab KillaCrab is offline
Registered User
 
Join Date: Jun 2003
Posts: 24
i storngly agree with sco08y. I prefer using option 1. given the fact that it is easier to manage (as earlier stated by sco08y) and requires less headaches.

it is easier distributing images(binary files) this way. no need to give anyone access to my directories just access to the database/application would be sufficient.
__________________
water water everywhere and the boards did shirnk
water water everywhere not a drop to drink
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On