cancel
Showing results for 
Search instead for 
Did you mean: 

Insert a .txt file as a record in a database table

Former Member
0 Kudos

Hi Experts,

I have a requirement that PI insert a .txt file (the whole file) as a record. Can we acheive this?

If we can please help me on this requirement. I have gone through below blog by

Regards,

Suhale Shaik.

Accepted Solutions (0)

Answers (2)

Answers (2)

iaki_vila
Active Contributor
0 Kudos

Hi Suhale,

I think blog is self-explanatory. I've used its java developing and works fine. You should take into account that you need a DB table with a BLOB field. Later you (or your DB team) need to do a Store Procedure in the DB which takes at least BLOB parameter and the primary key fields (recommendable the rest of the fields as well) to insert/update the record with the field BLOB. Later you can develop your PI scenario using the java mapping developed by Praveen. With Oracle i haven't had any problem.

If your scenario is file - jdbc, you can move the files in the sender adapter to a temporary folder and to use the Praveen's code pointing the path in the FileInputStream(args[0]) declaration(ie FileInputStream("/usr/sap/myfiledata/temp").

Also you can avoid to deal directly with the file system and try to pass the file as attachment in mapping time, but this way is more complicated.

Regards.

former_member181985
Active Contributor
0 Kudos

Hi Suhale Shaik,

I hope the blog is clear to understand.

Are you facing any issue to realize it for your requirement?

//BR,

Praveen Gujjeti