2. Mule Database connector has a very powerful feature of accessing Database.
The Database connector allows you to connect with almost any Java Database
Connectivity (JDBC) relational database .
In this demonstration we will see how to access 2 different databases of 2 different
types in parallel.
3. To access to database at a same time in parallel we will use scatter-gather in our
Mule flow.
The routing message processor Scatter-Gather will access multiple database concurrently. It
collects the responses from all routes, and aggregates them into a single message.
4. Let us consider we will retrieve data from 2 different databases :-
• MSSql server
• PostgresSQL
5. Let us first check our PostgresSQL database, we will find the following data in the
table:-
6. Now, we will check our MSSQL Server database and find the following data in the
table:-
7. Now, we will retrieve the data from both the database in parallel … Here is our Mule
flow:-
Here we can see that both the database flow are put into scatter-gather so that
we can retrieve the data from both the Database concurrently
8. Here is our both the flow:-
Here we can see that both the database retrieve the data from it’s table
concurrently and put the data into a logger
10. So, to test the application if we hit the url http://localhost:8082/db we will get the
following in the browser, a combined payload or rows from both the table:-
11. And in logger you can see that the Data has been retrieve from both the database
table concurrently and displayed in the log as well as a combined payload of both
the rows from both the table:-
12. In my next slide I will bring some other techniques in Mule implementation .
Hope you have enjoyed this simpler version.
Keep sharing your knowledge and let our Mule community grow