<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article Qlik Talend Data Integration: Inserting BLOB or CLOB data into a database in Official Support Articles</title>
    <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Talend-Data-Integration-Inserting-BLOB-or-CLOB-data-into-a/ta-p/2151175</link>
    <description>&lt;P&gt;Some projects require a large string or block of binary data to be stored in a database. A &lt;STRONG&gt;BLOB&lt;/STRONG&gt; (Binary Large Object) is a data type that can be used to store a large collection of binary data in a database table. A &lt;STRONG&gt;CLOB&lt;/STRONG&gt; (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.&lt;/P&gt;
&lt;P&gt;This article explains how to insert images into a MySQL table with a BLOB type. The example can be adapted, with minor changes, to use the CLOB type or another database.&lt;/P&gt;
&lt;H4&gt;&amp;nbsp;&lt;/H4&gt;
&lt;H4&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;Environment&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;This procedure was written with:&lt;/P&gt;
&lt;UL class="lia-list-style-type-circle"&gt;
&lt;LI&gt;Talend Open Studio for Data Integration 5.5.0-r117820&lt;/LI&gt;
&lt;LI&gt;JDK version: Sun JDK build 1.6.0_26-b03&lt;/LI&gt;
&lt;LI&gt;Operating system: Windows 7 Professional, 64-bit&lt;/LI&gt;
&lt;LI&gt;Mysql 5.0.67-community-nt&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Talend verified this procedure to be compatible with Data Integration releases starting from v4.2.3.&lt;/P&gt;
&lt;H3&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;Procedure&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/H3&gt;
&lt;P&gt;This example uses a MySQL table with two fields: &lt;STRONG&gt;ID&lt;/STRONG&gt; and &lt;STRONG&gt;picture&lt;/STRONG&gt;. The table definition is as follows:&lt;/P&gt;
&lt;PRE&gt;CREATE TABLE blobdemo (
  Id int(11) NOT NULL auto_increment,
  Picture blob,
  PRIMARY KEY (`Id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8&lt;/PRE&gt;
&lt;P&gt;A specific folder (for example &lt;STRONG&gt;D:\image\&lt;/STRONG&gt;) stores the pictures that will be inserted into the &lt;STRONG&gt;blobdemo&lt;/STRONG&gt; table.&lt;/P&gt;
&lt;H4&gt;&amp;nbsp;&lt;/H4&gt;
&lt;H4&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Creating a user routine&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;Create a user routine called &lt;STRONG&gt;MyRoutineDemo&lt;/STRONG&gt;. It has a &lt;STRONG&gt;ByteArrayFromFile&lt;/STRONG&gt; function that requires a file path as input parameter and is used to read a file and convert it to a byte array. The user routine code for this example follows.&lt;/P&gt;
&lt;PRE&gt;package routines;public class MyRoutineDemo {
public static byte[] ByteArrayFromFile(String filepath) {
try{ 
java.io.File file=new java.io.File(filepath);
java.io.FileInputStream fis = new java.io.FileInputStream(file);
int fileLength = (int) file.length();
byte[] incoming_file_data = new byte[fileLength]; // allocate byte array of right size
fis.read(incoming_file_data, 0, fileLength ); // read into byte array
fis.close();
return incoming_file_data;
}catch(Exception err){
err.printStackTrace();return null;
}
}
}
&lt;/PRE&gt;
&lt;P&gt;For details on creating a user routine, see How to create user routines&amp;nbsp;in the &lt;A href="https://help.talend.com" target="_blank" rel="noopener"&gt;Talend Help Center&lt;/A&gt;.&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;Creating demo job&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;Create a Job to iterate over the picture files in the &lt;STRONG&gt;D:\image\&lt;/STRONG&gt; folder and insert each one into the &lt;STRONG&gt;blobdemo&lt;/STRONG&gt; table. The Job design is shown in the following image and is available in the attached Zip file:&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="0693p000008uAxVAAU.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/123296i0E3A9B1B8FC8448B/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p000008uAxVAAU.png" alt="0693p000008uAxVAAU.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;tFileList&lt;/STRONG&gt;: Iterate all pictures in the &lt;STRONG&gt;D:\image\&lt;/STRONG&gt; folder.&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="0693p000008uB6zAAE.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/122044i774A647737F10FFE/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p000008uB6zAAE.png" alt="0693p000008uB6zAAE.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;tFixedFlowInput&lt;/STRONG&gt;: get the current file path and output it.&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="0693p000008uB74AAE.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/124999iD2174731C2D085FB/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p000008uB74AAE.png" alt="0693p000008uB74AAE.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;tMap&lt;/STRONG&gt;: call the routine to read file as byte array.&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="0693p000008uB1NAAU.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/124941iA37EF8A0E63B52F4/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p000008uB1NAAU.png" alt="0693p000008uB1NAAU.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;tMysqlOutput&lt;/STRONG&gt;: insert the BLOB data into target table, select BLOB type in the Db type List to map the &lt;STRONG&gt;byte[]&lt;/STRONG&gt; type on the schema of &lt;STRONG&gt;tMysqlOutput&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="0693p000008uAaEAAU.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/124845i59F11A09FACB1AEE/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p000008uAaEAAU.png" alt="0693p000008uAaEAAU.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;Executing the Job&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;Execute the Job, then query the &lt;STRONG&gt;blobdemo&lt;/STRONG&gt; table to verify that the pictures were inserted successfully.&lt;/P&gt;</description>
    <pubDate>Mon, 22 Dec 2025 08:26:42 GMT</pubDate>
    <dc:creator>TalendSolutionExpert</dc:creator>
    <dc:date>2025-12-22T08:26:42Z</dc:date>
    <item>
      <title>Qlik Talend Data Integration: Inserting BLOB or CLOB data into a database</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Talend-Data-Integration-Inserting-BLOB-or-CLOB-data-into-a/ta-p/2151175</link>
      <description>&lt;P&gt;Some projects require a large string or block of binary data to be stored in a database. A &lt;STRONG&gt;BLOB&lt;/STRONG&gt; (Binary Large Object) is a data type that can be used to store a large collection of binary data in a database table. A &lt;STRONG&gt;CLOB&lt;/STRONG&gt; (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.&lt;/P&gt;
&lt;P&gt;This article explains how to insert images into a MySQL table with a BLOB type. The example can be adapted, with minor changes, to use the CLOB type or another database.&lt;/P&gt;
&lt;H4&gt;&amp;nbsp;&lt;/H4&gt;
&lt;H4&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;Environment&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;This procedure was written with:&lt;/P&gt;
&lt;UL class="lia-list-style-type-circle"&gt;
&lt;LI&gt;Talend Open Studio for Data Integration 5.5.0-r117820&lt;/LI&gt;
&lt;LI&gt;JDK version: Sun JDK build 1.6.0_26-b03&lt;/LI&gt;
&lt;LI&gt;Operating system: Windows 7 Professional, 64-bit&lt;/LI&gt;
&lt;LI&gt;Mysql 5.0.67-community-nt&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Talend verified this procedure to be compatible with Data Integration releases starting from v4.2.3.&lt;/P&gt;
&lt;H3&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;Procedure&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/H3&gt;
&lt;P&gt;This example uses a MySQL table with two fields: &lt;STRONG&gt;ID&lt;/STRONG&gt; and &lt;STRONG&gt;picture&lt;/STRONG&gt;. The table definition is as follows:&lt;/P&gt;
&lt;PRE&gt;CREATE TABLE blobdemo (
  Id int(11) NOT NULL auto_increment,
  Picture blob,
  PRIMARY KEY (`Id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8&lt;/PRE&gt;
&lt;P&gt;A specific folder (for example &lt;STRONG&gt;D:\image\&lt;/STRONG&gt;) stores the pictures that will be inserted into the &lt;STRONG&gt;blobdemo&lt;/STRONG&gt; table.&lt;/P&gt;
&lt;H4&gt;&amp;nbsp;&lt;/H4&gt;
&lt;H4&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Creating a user routine&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;Create a user routine called &lt;STRONG&gt;MyRoutineDemo&lt;/STRONG&gt;. It has a &lt;STRONG&gt;ByteArrayFromFile&lt;/STRONG&gt; function that requires a file path as input parameter and is used to read a file and convert it to a byte array. The user routine code for this example follows.&lt;/P&gt;
&lt;PRE&gt;package routines;public class MyRoutineDemo {
public static byte[] ByteArrayFromFile(String filepath) {
try{ 
java.io.File file=new java.io.File(filepath);
java.io.FileInputStream fis = new java.io.FileInputStream(file);
int fileLength = (int) file.length();
byte[] incoming_file_data = new byte[fileLength]; // allocate byte array of right size
fis.read(incoming_file_data, 0, fileLength ); // read into byte array
fis.close();
return incoming_file_data;
}catch(Exception err){
err.printStackTrace();return null;
}
}
}
&lt;/PRE&gt;
&lt;P&gt;For details on creating a user routine, see How to create user routines&amp;nbsp;in the &lt;A href="https://help.talend.com" target="_blank" rel="noopener"&gt;Talend Help Center&lt;/A&gt;.&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;Creating demo job&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;Create a Job to iterate over the picture files in the &lt;STRONG&gt;D:\image\&lt;/STRONG&gt; folder and insert each one into the &lt;STRONG&gt;blobdemo&lt;/STRONG&gt; table. The Job design is shown in the following image and is available in the attached Zip file:&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="0693p000008uAxVAAU.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/123296i0E3A9B1B8FC8448B/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p000008uAxVAAU.png" alt="0693p000008uAxVAAU.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;tFileList&lt;/STRONG&gt;: Iterate all pictures in the &lt;STRONG&gt;D:\image\&lt;/STRONG&gt; folder.&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="0693p000008uB6zAAE.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/122044i774A647737F10FFE/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p000008uB6zAAE.png" alt="0693p000008uB6zAAE.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;tFixedFlowInput&lt;/STRONG&gt;: get the current file path and output it.&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="0693p000008uB74AAE.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/124999iD2174731C2D085FB/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p000008uB74AAE.png" alt="0693p000008uB74AAE.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;tMap&lt;/STRONG&gt;: call the routine to read file as byte array.&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="0693p000008uB1NAAU.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/124941iA37EF8A0E63B52F4/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p000008uB1NAAU.png" alt="0693p000008uB1NAAU.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;tMysqlOutput&lt;/STRONG&gt;: insert the BLOB data into target table, select BLOB type in the Db type List to map the &lt;STRONG&gt;byte[]&lt;/STRONG&gt; type on the schema of &lt;STRONG&gt;tMysqlOutput&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="0693p000008uAaEAAU.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/124845i59F11A09FACB1AEE/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p000008uAaEAAU.png" alt="0693p000008uAaEAAU.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;Executing the Job&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;Execute the Job, then query the &lt;STRONG&gt;blobdemo&lt;/STRONG&gt; table to verify that the pictures were inserted successfully.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Dec 2025 08:26:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Talend-Data-Integration-Inserting-BLOB-or-CLOB-data-into-a/ta-p/2151175</guid>
      <dc:creator>TalendSolutionExpert</dc:creator>
      <dc:date>2025-12-22T08:26:42Z</dc:date>
    </item>
  </channel>
</rss>

