Results 1 to 4 of 4
  1. #1
    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?

  2. #2
    Join Date
    Dec 2007
    Location
    London, UK
    Posts
    741
    That is exactly what SQL Server Filestream does:
    FILESTREAM Overview

  3. #3
    Join Date
    Dec 2007
    Location
    London, UK
    Posts
    741
    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.

  4. #4
    Join Date
    Aug 2009
    Posts
    6
    I'm running PostgreSQL.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •