We found that we are going to have to store a bunch of PDF documents somewhere, somehow. An easy choice is to store them in an IFS folder. We will only have to search, glance at these documents once in a while. Are there any pros/cons to storing these documents in DB2 as a CLOB or BLOB?
Announcement
Collapse
No announcement yet.
IFS or DB2 to store documents?
Collapse
X
-
It would not be good to use a CLOB since PDF is a binary format, this would run the chance of corrupting the file and making it unusable. So I assume you really want to compare BLOB vs stream file.
Advantage of a BLOB: You can return the data as a column of a SELECT statement. This means as you're doing (potentially complex and sophisticated) database queries across your database tables, by various different indexes and selection criteria, you'd be able to return a PDF as one of the columns.
Disadvantage of BLOB: I don't know of any PDF software that directly reads database tables, so you'd have to always call a routine that outputs the PDF to a stream file, or streams it to a browser, or similar before you'd be able to view it.
Advantage of stream file: It's right there... any PDF viewer software can view it. This method also uses less disk space, if that's a concern.
Disadvantage of stream file: Can't include other columns of data, can't create indexes over it, can't query it, etc.
Comment
-
Another advantage of storing them in the DB is ease of finding and deleting them. For example if you have to deal with strict data management regulations (that require data is deleted when it's no longer needed like the European GDPR), that is (in my experience) easier if its on a keyed database record, as its no different than any other DB record. Whereas if its on the IFS you need additional code to find the filename, look it up on the IFS, and delete it there.
And I think BLOBs also make it easier to transfer the files over external interfaces like SQL procedures.
Comment
Comment