Import binary files into Postgres Database

One Star

Import binary files into Postgres Database

I need to migrate binary files (pdfs, txt,...) from disk into a Postgres Database (bytea). How does this work, is it even possible?

Re: Import binary files into Postgres Database

You load the file into the database using lo_import(), and retrieve it from the database using lo_export().
in the advanced settings of your postgres output, under additional columns, replace your blob column with lo_import(?)
the data value for this column should be the file name you want to insert to the blob.
One Star

Re: Import binary files into Postgres Database

as I know lo_import() is only for oid
for bytea you need a JDBC PreparedStatement, right?
I thought there is a easier way in talend to do this (in combination with tmap)
Community Manager

Re: Import binary files into Postgres Database

Hi
You can find a similar request in topic:
http://www.talendforge.org/forum/viewtopic.php?id=1753
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business