Skip to main content Skip to complementary content

How to insert images into a MySQL table with BLOB type

This article explains how to insert images into a MySQL table with BLOB type.

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.

Prerequisites

  • This example uses a MySQL table, named blobdemo, with two fields: Id and Picture. The table definition is as follows:
    Screenshot of the blobdemo MySQL table.
  • A specific folder, in this example "C:/Talend/images", stores the pictures that will be inserted into the blobdemo table.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!