Saturday, August 8, 2015

How to fetch multiple rows from database in WSO2 ESB using DBLookup or DBReport Mediator

There is no such a way to fetch multiple rows in ESB using DBReport or DBLookup mediator. In ESB these mediator only gives you one row even if you write query to fetch multiple rows. It will give you only the first row from the database.

To fetch multiple rows from Database in ESB you have to use DSS or also you can create your own custom mediator.

You can create dataservice in DSS and call its end point in ESB, this is the simplest way to get multiple rows from database in ESB. To create data service in DSS you can see this blog http://shriwithjava.blogspot.co.nz/2013/08/creating-my-first-data-service-wso2.html.

OR

If you don’t want to use DSS then create your own logic in custom mediator and use in ESB. To create a custom mediator you can follow this blog http://shriwithjava.blogspot.co.nz/2015/08/how-to-write-custom-mediator-in-wso2-esb.html