In DB2, BLOB (Binary Large Object) is a data type used to store large amounts of binary data, such as images, audio files, video files, and other unstructured binary data. More: DB2 BLOB.
| Type in IBM DB2 | Maximum size |
|---|---|
BLOB(n) | up to 2 GB (2,147,483,647 bytes) |
BLOB (no length) | defaults to only 1 MB |
BLOB FILE | stores a file reference, data stays in the file system |
BLOB holds raw bytes and DB2 never converts them; CLOB is decoded with the database code page and its length counts characters. Images, archives and encrypted blobs can only go into a BLOB.
DB2 keeps LOB data in a separate LOB tablespace, and db2 export only writes a lob locator unless you pass a lob to directory. Miss it and the export "succeeds" while the actual data is never written.
db2 export to out.del of del lob to ./lobs/db2 import from in.del of del lobs from ./lobs/BLOB column declared without a length defaults to 1 MB - larger values are truncated silentlylob to produces a file full of 100-byte locators instead of datadb2move to copy BLOBs between databases - it handles the LOB tablespace and files for you