Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2015
    Posts
    8

    Wink Unanswered: How to store images in DB2

    Hello Everyone,

    I would like to know which is the sql command to store images into db2 database.
    I have read that there are two data types in db2 to do so: BLOB and CLOB.

    I was looking to create a table where to save the images info(when and where was taken) and the image itself.

    Thanks for the help.

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    I suggest you read the documentation on the difference of two to determine which is appropriate.

    Then post what you think you need, and we will comment on that. We will not do the work for you.

    Andy

  3. #3
    Join Date
    May 2012
    Location
    Canberra, Australia
    Posts
    176
    Provided Answers: 6
    have a look in the samples e.g.
    http://www-01.ibm.com/support/knowle...s-dtlob-c.html
    there are also samples for Perl, JDBC etc
    and have a look at this but limited max lob size of 10M
    http://www-01.ibm.com/support/knowle.../r0055115.html
    Last edited by tafster; 09-03-15 at 19:11.
    Andy

    "All parts should go together without forcing. You must remember that the parts you are reassembling were disassembled by you. Therefore, if you can’t get them together again, there must be a reason. By all means, do not use hammer.” — IBM maintenance manual, 1975 "

  4. #4
    Join Date
    Aug 2015
    Location
    Bucharest
    Posts
    9
    Easyer, you could keep the images in a separate folder and store in database the path of the each image.

  5. #5
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Quote Originally Posted by iRelevant View Post
    Easyer, you could keep the images in a separate folder and store in database the path of the each image.
    Then everyone would need access to that folder--big security issue. And what would happen if someone deletes files from that folder without telling the database?

    Andy

  6. #6
    Join Date
    Aug 2015
    Location
    Bucharest
    Posts
    9
    Indeed. But take into consideration that the database can be stored on a server and the folder with the images is accesible only for the admin.
    In addition, for .img files you can set permissions for deleting to deny for everyone.
    Last edited by iRelevant; 09-18-15 at 05:22.

  7. #7
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    If the images are stored and managed by the database, then the images should only be accessed through the database. The folder that they reside in belongs to the database and should not be accessed outside--even though admins can access it outside of the database.

    Using permissions to restrict delete would work if the images never need to be removed.

    My point was that storing the images separately and putting a pointer to them will eventually lead to then getting out of sync since they are administered separately.

    Andy

Tags for this Thread

Posting Permissions

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