Skip to Content
0

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

Mar 16, 2017 at 09:29 AM

69

avatar image

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)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Harish Mistri Mar 17, 2017 at 12:36 AM
0

Hi Ashok,

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

regards,

Harish

Share
10 |10000 characters needed characters left characters exceeded
Iñaki Vila Mar 17, 2017 at 11:06 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
pankaj yadav Mar 17, 2017 at 11:36 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Evgeniy Kolmakov Mar 18, 2017 at 12:15 PM
0

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.

Share
10 |10000 characters needed characters left characters exceeded