Some projects require a large string or block of binary data to be stored in a database. A BLOB (Binary Large Object) is a data type that can be used to store a large collection of binary data in a database table. A CLOB (Character Large Object) is a data type that can be used to store a large collection of character data in a database table.
For example, a digital file containing a picture, video, or a song can be stored in a database using a BLOB, or a plain text file can be stored in a database using a CLOB. This article explains how to insert images into a Mysql table with BLOB type.
The example can be adapted, with minor changes, to use the CLOB type or another database.
- This example uses a MySQL table, named blobdemo, with two fields:
Id and Picture. The table definition is
- A specific folder, in this example "C:/Talend/images", stores the pictures that will be inserted into the blobdemo table.