Hi All,
Using Talend job , I need to retrieve images from data base to local system. Images are stored in DB as byte array.
Could any 1 please guide me on this.
No Luck Pedro,
I tried uploading new image to DB (even different formats) & retried to download but no luck. Issue remains the same.
Should I mail You the complete job or upload the screen shots ?
I think you can read it in as an object type and map this to an object typ output in a tMap. No coding required.
Hi janhess,
Thanks.. Could You Please elaborate ur approach, though i read it like an object, how can I write that object with out coding... please explain
Thanks janhess ..
Still, I continue to face the same issue, Please fine the attachment. In which I have uploaded the image which I m trying to read from DB and also the job flow.
Thanks for ur time..
Hi Team,
Some where I m going wrong, either reading or may be while uploading to DB itself.
So, please look in to the attachments for the way I am uploading my image to DB.
& I have already posted the way I m reading it. So, please let me know in case if i m wrong.
Routine Code:
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;
fis.read(incoming_file_data, 0, fileLength );
fis.close();
return incoming_file_data;
}
catch(Exception err)
{
err.printStackTrace();
return null;
}
}
You didn't specify a field length in your output. Should be the same as input. I use this to import images to a database. The rule in the tMap is ImageUtil.getByte(row6.abs_path) where abs_path is the path to the image file package routines; import java.io.FileInputStream; import java.io.File; import java.io.FileNotFoundException; public class ImageUtil { public static byte[] getByte(String filepath) { byte[] b=null;