Possible?

Discussion in 'Databases' started by Handsofmodder, Sep 27, 2008.

  1. #1
    Is it possible to store files like .swf, .wmv, .jpg, etc to a database? If so, then how would you do it?
     
    Handsofmodder, Sep 27, 2008 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    Yes, you can store just about any file-type if you use a blob data type column. You can also base64 encode the data in the file and store it in a text field.
     
    jestep, Sep 27, 2008 IP
  3. VirgilM

    VirgilM Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    it i possible, but it is not recommended, because your database will grow and it will slow the server a lot. Instead it is recommended to store into the database just the name and location of the files.
     
    VirgilM, Sep 28, 2008 IP
  4. chisara

    chisara Peon

    Messages:
    141
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    In PostgreSQL you have an non SQL standard Bytea(rray) datatype which has the advantage of automatic LZ compression on the data when it meets certain criteria.
     
    chisara, Sep 28, 2008 IP
  5. Social.Network

    Social.Network Member

    Messages:
    517
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    35
    #5
    I agree that you should store only the name and full qualified path to the files versus a blob. I recently completed a project where the architect made the decision to store all documents as blobs in the database. Well, I cannot begin to enumerate all of the issues. A couple of the issues were managing the huge backups and not having the ability to view the blob contents. There was no way to view the blobs outside of the application. We had to write a custom utility to search and view the blobs in the database.
     
    Social.Network, Sep 28, 2008 IP