Skip to Content

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

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 @Praveen Gujjeti

SAP XI/PI: Storing BINARIES (Images, PDFs etc.) in the Database (BLOBs) Using JDBC Adapter

Regards,

Suhale Shaik.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Dec 09, 2014 at 03:04 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 09, 2014 at 05:23 PM

    Hi Suhale,

    I think Praveen Gujjeti's 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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.