Skip to Content
avatar image
Former Member

Insert Multiple rows - JDBC Receiver Adapter

Hi Experts,

I have a scenario , where the record needs to be inserted in Multiple rows, I searched in scn and following some blogs, but still no luck.

  Below is the input structure:

 

<?xml version="1.0" encoding="UTF-8"?>

<ns0:MT_TGTDB_0 xmlns:ns0="http://multiplerow">

   <tbldummy_PI_test>

      <row>

         <MemberID>M1</MemberID>

         <MemberName>Baskar</MemberName>

         <Premium>

            <PremiumID>Pi</PremiumID>

            <PremiumName>Siva</PremiumName>

         </Premium>

      </row>

   </tbldummy_PI_test>

</ns0:MT_TGTDB_0>

I want the data to be inserted multiple rows in table as below

 

M1 | Baskar

P1 | Siva

 

But right now , only 1 row inserted.

 

M1 | Baskar

Note: i have duplicated "access" and mapped to PremiumId & PremiumName , but it seems PI is not accepting access1.

Attachment has the configurations done.

MessageMapping Definition: MM_Definition.PNG

MessageMapping Test:MM_Test.PNG

Communication channel monitoring: CC.PNG

Thanks in advance,

Baskar

CC.PNG (5.4 kB)
MM_Test.PNG (36.4 kB)
MM_Definition.PNG (38.3 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    May 24, 2013 at 02:48 PM

    Baskar,

    Why you have given name for second record as access1? that is wrong change it to access.

    If you wanna update multiple records in same table then you have to generate access tag twice using mapping.map root node of row to access .

    Thank you,

    Raj

    Add comment
    10|10000 characters needed characters exceeded

    • MT_IB

      _STATEMENTINSERT1

      __EMP_QUALIFICATION

      ___ACTION(insert)

             Table

      ____access

                Xyz

                Mno

      _STATEMENTINSER2

      __EMP_QUALIFICATION

      ___ACTION(insert)

             Table

      ____access

                Xyz

                Mno

      try the format.

  • May 24, 2013 at 04:59 PM

    Hi Baskar,

    You need to do an intermediate mapping to arrive at an intermediate structure like below:

    So your interface will have 2 graphical mappings instead of 1. In the first mapping, you will populate your intermediate structure with the outcome as below:

         <row>

             <MemberID>M1</MemberID>

             <MemberName>Baskar</MemberName>

        </row>

         <row>

             <MemberID>Pi</MemberID>

             <MemberName>Siva</MemberName>

             </row>

    this will be dependent on the source structure and Occurance of nodes row, Premium.If you can send that, I can help further.

    In the second mapping you populate the JDBC structure.

    Then you can map the row (with remove context) to the Statements node in the target; access can be mapped to a constant while the fields can be mapped one to one.

    Then you will surely be able to populate the target JDBC structure with 2 records as desired. 😊

    Hope it helps!

    Ambrish

    Add comment
    10|10000 characters needed characters exceeded

    • Baskar,

      Here is how you do the first mapping. It turned out to be very simple.

      You map row in source to First Row in the target. Duplicated Row is mapped to Premium.

      rest fields are mapped one to one.

      I tested it with following test case:

      It works...

      Now you map the intermediate structure in next mapping to JDBC structure like I suggested.

      Map row(removeContext to Statements.

      access to be mapped to constant.

      rest fields one to one.

      check in database 😊

      Hope it helps!

      Ambrish

      Updated with a better screenshot of first mapping Message was edited by: Ambrish Mishra

      pastedImage_0.png (16.7 kB)
      pastedImage_1.png (31.1 kB)
      pastedImage_0.png (17.6 kB)
  • May 24, 2013 at 02:05 PM

    Hi Baskar,

    you can go ahead two statements parallel execution. so create 2 statements indivually in one message and update  with different row.

    second option is give pass sql query directly and execute.

    Regards,

    Loordh

    Add comment
    10|10000 characters needed characters exceeded

  • May 24, 2013 at 04:42 PM

    Hi Baskar,

    My bad!

    I did not look at the source message type clearly. let me figure out a solution and revert back.

    Ambrish

    PS: I have deleted my posts so that others are not confused but the solution will be on same line.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 25, 2013 at 06:40 AM

    Thanks all for all your support to fix this issue.

    Baskar

    Add comment
    10|10000 characters needed characters exceeded