Talend - Binary object

One Star

Talend - Binary object

Hello,
Does talend allow ETL operations on binary objects like sql-server varbinay, oracle - BLOB or we need to provide some workarounds?
Thanks
One Star

Re: Talend - Binary object

Hi
Step1:
Let's create a user routine called 'MyRoutineDemo'. It has a ByteArrayFromFile function, that is used to read a file and convert it to a byte array. As seen below:
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; // 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;
}
}
}
Step2:
Create a job to iterate each picture in the "D:/image/" folder and insert them into the 'blobdemo' table. The job design is detailed in the pictures below.
Regards,
Pedro