If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Storing Images Via a Database

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-11-10, 13:00
wswartzendruber wswartzendruber is offline
Registered User
 
Join Date: Aug 2009
Posts: 6
Storing Images Via a Database

Let's say I have an online photo gallery. Well the usual way to do this is store a URL to the images in a table. This, however, seems like a poor separation, as the website is a front-end and the table is a back-end, and you have a server referring to something in a client.

Instead, why not store the images as separate files on the DB server itself, and use a view/query to read the image from disk and return it to the client as a binary blob. This way, any front-end has access to the images, not just that specific web server.

What are the pitfalls of this approach?
Reply With Quote
  #2 (permalink)  
Old 03-11-10, 15:44
dportas dportas is offline
Registered User
 
Join Date: Dec 2007
Location: London, UK
Posts: 732
That is exactly what SQL Server Filestream does:
FILESTREAM Overview
Reply With Quote
  #3 (permalink)  
Old 03-11-10, 15:47
dportas dportas is offline
Registered User
 
Join Date: Dec 2007
Location: London, UK
Posts: 732
Quote:
Originally Posted by wswartzendruber View Post
What are the pitfalls of this approach?
The problem with a roll-your-own approach is that you won't get native support for transactions, integrity, backup and recovery. You still have to manage the file system data yourself. Native support like Filestream means that those things are taken care of for you even for the data hosted on the filesystem.
Reply With Quote
  #4 (permalink)  
Old 03-11-10, 22:46
wswartzendruber wswartzendruber is offline
Registered User
 
Join Date: Aug 2009
Posts: 6
I'm running PostgreSQL.
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

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