Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
Labels (2)
1 Reply
Anonymous
Not applicable
Author

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