By Anirban Sen Chowdhary
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.
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.
Let us consider we will retrieve data from 2 different databases :-
• MSSql server
• PostgresSQL
Let us first check our PostgresSQL database, we will find the following data in the
table:-
Now, we will check our MSSQL Server database and find the following data in the
table:-
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
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
Our Mule config will be:-
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:-
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:-
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 
Mule accessing multiple database in parallel

Mule accessing multiple database in parallel

  • 1.
    By Anirban SenChowdhary
  • 2.
    Mule Database connectorhas 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 todatabase 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 considerwe will retrieve data from 2 different databases :- • MSSql server • PostgresSQL
  • 5.
    Let us firstcheck our PostgresSQL database, we will find the following data in the table:-
  • 6.
    Now, we willcheck our MSSQL Server database and find the following data in the table:-
  • 7.
    Now, we willretrieve 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 ourboth 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
  • 9.
    Our Mule configwill be:-
  • 10.
    So, to testthe 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 loggeryou 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 nextslide 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 