shlogg · Early preview
Judy @esproc_spl

Joining MySQL & Oracle Tables With EsProc

Joining MySQL persons with Oracle orders tables using esProc script. Full join on id_p lists all desired data. Read more: Download esProc script and integrate with Java.

Problem description & analysis
There is a data table persons in MySQL, as shown below:

There is a data table orders in Oracle, as shown below:

We are trying to list all people and all orders in a corresponding way. Below is the desired result:

Solution
Write the following script p1.dfx in esProc:

Explanation:
A1  Connect to MySQL database.
A2  Get data from persons table.
A3  Connect to Oracle database.
A4  Get data from orders table.
A5  Perform a full join on A2 and A4 by id_p to list all desired data.
Read How to Call an SPL Script in Java to learn how to integrate the script code into...