Skip to Content
avatar image
Former Member

Insert File into a Database

Hi friends,

Our scenario is, we get files from different customers,

Once we read the files for the customer number,

The target is a Database table where we have to insert customer number in column1, date and time in column2, and the complete content of the file in column3(database table can handle any big data).

Is it possible to insert the entire content of the file into the database table using JDBC receiver.

Thanks for your inputs

Ven.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Oct 14, 2009 at 02:32 PM

    Hi Ven,

    >>Is it possible to insert the entire content of the file into the database table using JDBC receiver.

    Yes it can be achieved. BTW what will be the file size and how are you planning to store it (XMLize and store or just store as plain text)

    Regards

    suraj

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Ven,

      This size wont be a problem,

      Now the flat file will be converted to an XML structure by the File Adapter. This structure should again be converted to flat for inserting into DB Field.. This should be the point of concern now...

      I guess you might be using some java or xslt mapping..

      Regards

      suraj

  • Oct 15, 2009 at 01:49 PM

    Hi Ven,

    we can insert the complete file into the database table of as single field, the size won't be the matter,

    the following is the xsl code to insert the file into the database.

    <?xml version='1.0' ?>

    <xsl:transform version="1.0"

    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

    xmlns:sap="http://www.sap.com/sapxsl">

    <xsl:strip-space elements="*"/>

    <xsl:output method="xml" version="1.1" encoding="utf-8"/>

    <xsl:template match="/">

    <ns0:trgjdbc_mt xmlns:ns0="http://readxml_uk">

    <STATEMENT><DATABASETABLE ACTION="INSERT"><TABLE>DATABASETABLE</TABLE><ACCESS><DETAILS>

    <xsl:text disable-output-escaping="yes"><![CDATA[<![CDATA[]]></xsl:text>

    <xsl:copy-of select="ns0:srcfile_mt"/>

    <xsl:text disable-output-escaping="yes"><![CDATA[<]]]]></xsl:text>

    <xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>

    </DETAILS></ACCESS></DATABASETABLE></STATEMENT>

    </ns0:trgjdbc_mt>

    </xsl:template>

    </xsl:transform>

    this code will be help ful to you.

    Add comment
    10|10000 characters needed characters exceeded