DB Report Mediator in WSO2 ESB

Introduction

This article focus on showing how WSO2 ESB DB Report mediator can be configured with a carbon data source. Using this DB Report mediator WSO2 ESB will be able to execute Insert statements to databases. The reverse operation of this is done by DB Lookup mediator, which can query data in a database. After fixing a bug in this mediator, gui has changed for adding a carbon data source in latest WSO2 ESB 4.6.0.

Adding a data source

In here I’m going to use mysql as the database. Therefore first you need to setup mysql server (in Linux:XAMPP or in windows: WAMP, but free to use your own too). Then you need to get the jdbc-connector and put it in to wso2esb-4.5.1/repository/components/lib folder. You have to create a database and a table in  mysql (in there I created ‘test’ database and ‘aa’ table inside it). Now you have done background setup. Next is to start WSO2 ESB.

Connecting to data source

In ESB web UI , goto Configure -> Data Sources -> Add Data Source. Then you have to point your database as shown in the image below. It is recommended to give JNDI name same to the Name of DB.

Screenshot from 2012-12-14 11:05:21

Adding DB Report Mediator

Go to the Main -> Sequences and edit mode of relevant sequence and add the DB Report mediator to appropriate place. In edit section showing below, select Data Source -> Carbon Data Source and select the name you gave from the list.

Screenshot from 2012-12-14 11:16:23

Then you can add the insertion statements according to the database table you made.

Reference:

1. DB Report Mediator guide: http://docs.wso2.org/wiki/display/ESB451/Sample+361%3A+Introduction+to+dbreport+Mediator

2. For DB Lookup Mediator: http://docs.wso2.org/wiki/display/ESB451/Sample+360%3A+Introduction+to+dblookup+Mediator

Advertisements

2 thoughts on “DB Report Mediator in WSO2 ESB

  1. Hi Buddhima,
    Accidentally came across your blog and it is great, it seems you have been doing this from the last year. Sorry to say this is the first time I cam across this :(. You definitely need better visibility to what you write. Good luck dude. Keep up the good work!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s