Re: how to store binary file data to a database blob

Discussion in 'Python' started by David Stockwell, May 27, 2004.

  1. Hi Ivan,

    Yep ur right. I'm hoping to avoid the politics of this. Basically I've
    been told to store it in the db and that's what will happen. The thought
    is that its easier to let the DB manage the data than it is to have to worry
    about some external process or person munging the data file stored on the
    filesystem at some location.

    With the db approach, if the db is munged you lose it all (up to the
    recovery point, backup, etc). With the file approach you could get just as
    hosed or worse, if the db loses its 'pointers' via fieldname contents to the
    files on the disk.

    So with all that in mind, we're storing blobs in our database.

    I have found out that I need to do something like this:
    insert a record (with no data)
    ask the DCOracle driver to hand me a 'pseudo file object for that record's
    blob'
    write the data to the pseudo file
    ....

    David
    -------
    Tracfone: http://cellphone.duneram.com/index.html
    Cam: http://www.duneram.com/cam/index.html
    Tax: http://www.duneram.com/index.html




    From: Ivan Voras <>
    To:
    Subject: Re: how to store binary file data to a database blob
    Date: Thu, 27 May 2004 17:39:33 +0200

    Benjamin Niemann wrote:

    using the % operator. This works at least for arbitrary strings (and
    that's the way to handle strings, if you don't like SQL injections ;)
    But I never tried this with blobs - perhaps they need some special treatment
    (thinking e.g. of laaarge files)...

    It is generally NOT a good idea to write large binary strings to a (sql
    relational) database, even if it has blobs. A much more robust (and faster)
    solution is to save general data about the blob in the database (its size,
    name, whatever, etc.) and the actual data in a separate file in the
    filesystem (or maybe in a "db" database (BDB, GDBM...), if you really like
    them).

    YMMV, mostly depending on the size of blobs. :)
    --
    http://mail.python.org/mailman/listinfo/python-list

    _

    _________________________________________________________________
    Is your PC infected? Get a FREE online computer virus scan from McAfee®
    Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
     
    David Stockwell, May 27, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Selen

    blob or store server

    Selen, Feb 20, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    312
    S. Justin Gengo
    Feb 20, 2004
  2. Universal
    Replies:
    1
    Views:
    620
    Lionel B
    Apr 8, 2005
  3. Universal
    Replies:
    0
    Views:
    470
    Universal
    Apr 8, 2005
  4. David Stockwell
    Replies:
    3
    Views:
    567
    Greg Gaughan
    May 28, 2004
  5. Rune Hansen

    MySQLdb blob and binary data

    Rune Hansen, Dec 10, 2004, in forum: Python
    Replies:
    1
    Views:
    1,652
    Denis S. Otkidach
    Dec 10, 2004
Loading...

Share This Page