One Star

binary files

I want to use a binary file as an input and then load in a postgreSQL database. The binary file has the following format when converted to ASCII
Name Marc
ID 00000000
Age 30
The type and size in bytes of each field are already specified.
what type of file in the metadata section in the repository do I need to use to specify the schema of the binary file
Thank you for your help
6 REPLIES
Community Manager

Re: binary files

Hello
See 3403
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: binary files

the link is dead, where was pointing.
I need to migrate binary files (pdfs, txt,...) into a Postgres Database (bytea). How does this work, is it even possible?
One Star

Re: binary files

I've the same question. Has someone an idea?
Ragrds,
Billy
Community Manager

Re: binary files

I've the same question. Has someone an idea?
Ragrds,
Billy

Hi Billy
This post is a little old, can you describe your request with more details?
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: binary files

I use this routine to put binary images into a MYSql database
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;

try {
FileInputStream fis = new FileInputStream(filepath);
b=new byte;
fis.read(b);
} catch (Exception e) {
e.printStackTrace();
}
return b;
}
}
In a tMap I then call it on the output using ImageUtil.getByte(file_path) where file _path is the full file path to your file. The output column is a byte array byte[]
Community Manager

Re: binary files

Hi
If the data is the file path of binary file, janhess's solution is good.
If you are migrate binary file from database to another database, set the type as byte[], db type as Blob or Clob on the schema of input/output db component.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business