Skip to Content

How to fetch the data from two tables at a time based on prymary key by JDBC sender adapter

Hi experts,

My scenario is JDBC to file.

To fetch the data from two different tables in the database, please help me how to create a sender JDBC structure I tried some blogs to create jdbc sender structure I'm getting error a sequence contains two elements with the global names I'm unable to understand the structure please suggest me. i want select the data based on primary key .capture5.png

please find the below sender structure

Thanks,

Ashok.

capture5.png (18.0 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Mar 17, 2017 at 12:36 AM

    Hi Ashok,

    The better option is to create a view in Database which can combine both the tables.

    regards,

    Harish

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 17, 2017 at 11:06 AM

    Hi Ashok,

    You can't have two rows definition with different tags. You should think that the tag below row are the result of the SELECT, I mean

    SELECT x y z

    FROM ....

    It would be

    <row>

    <x>

    <y>

    <z>

    </row>

    If the SELECT gives several results, you will have several rows but the structure will be the same.

    Regards.

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 17, 2017 at 11:36 PM

    Hi Ashok ,

    harish is saying right . you can crate the view for two table , based on this view you can fatch the data from two different table . I am also using view for fetching the data 3 different table . you can not create the same element name in data type .

    Regards

    P .Singh

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 18, 2017 at 12:15 PM

    Hi Ashok!

    I'm not much experienced in working with JDBC, but why not to use Select statement with JOIN condition to fetch data from different tables. For example:

    SELECT a.field1, b.field1 as newfield1 FROM a LEFT OUTER JOIN b ON a.field2=b.field3 WHERE a.field3=some_condition

    Actually, the view you create in target DB contains similar type of Select statement which is executed when you query the view.

    Regards, Evgeniy.

    Add comment
    10|10000 characters needed characters exceeded