mule with stored procedure

14
Mule with Stored Procedure Feroz Khan

Upload: mdfkhan625

Post on 20-Jan-2017

339 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Mule with stored procedure

Mule with Stored ProcedureFeroz Khan

Page 2: Mule with stored procedure

Mule's database component allows us to connect with almost any Java Database Connectivity (JDBC) relational database and it has wonderful capabilities to perform various functionalities and run diverse SQL operations on our database, including Select, Insert, Update, Delete, and even Stored Procedures.

We will have a look here on how to use Stored Procedures with our Mule database component. So, before we start using Stored Procedures in our Mule, we will create a Stored Procedures in the database and then call to from our Mule application.

Page 3: Mule with stored procedure

Creating a Store Procedure

Page 4: Mule with stored procedure

So, we will get into our database and create a Stored Procedures there. In our case we will use MS SQL.Let's create Stored Procedure by following way :

Here, as we can see we have created a Stored Procedure called SP_TEST, which will take 2 inputs variable V1 and V2 and will sum it and return the total variable after adding both the variables.

Page 5: Mule with stored procedure

After our Stored Procedure has been created successfully we will test it in following way :-

We can see here, we are passing 2 integer values in the input variables V1 and V2, and it's coming out with the total value as output with the addition of these 2 variables.

Page 6: Mule with stored procedure

Stored Procedure with Mule

Page 7: Mule with stored procedure

So, now we will try to call this Stored Procedure from our Mule application in following way :-

We can see here we are using Mule database component to call this Stored Procedure and passing 2 input parameter and 1 output parameter to display the result.

Page 8: Mule with stored procedure

The corresponding Mule flow in graphical will be as following:-

Page 9: Mule with stored procedure

Testing our application ……

Page 10: Mule with stored procedure

Now, we are done with our coding and will deploy our application and test it.So, now if we will hit the url :- http://localhost:8081/test/test in browser, we will get the following result in Mule console :-

We can see here the Stored Procedure is called and we are getting the total value from our Mule application.

Page 11: Mule with stored procedure

Conclusion

Page 12: Mule with stored procedure

As we can see it's very simple to call any Stored Procedure from our Mule application as the database component of Mule supports diverse SQL operations and Stored Procedures on our Database.

That's all !!! I've hopefully been clear enough in displaying the implementation of database component and calling Stored Procedure from our Mule application.

I hope you liked this !!!

Page 13: Mule with stored procedure

Hope you enjoyed the simple yet an amazing trick in Mule

You can also find this post here :- http://bushorn.com/mule-with-stored-procedure/

Page 14: Mule with stored procedure

Thank You