15
Mule with Stored Procedure

Mule stored procedure

Embed Size (px)

Citation preview

Page 1: Mule stored procedure

Mule with Stored Procedure

Page 2: Mule 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 stored procedure

Creating a Store Procedure

Page 4: Mule stored procedure

Creating a Store Procedure

Page 5: Mule 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 6: Mule 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 7: Mule stored procedure

Stored Procedure with Mule

Page 8: Mule 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 9: Mule stored procedure

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

Page 10: Mule stored procedure

Testing our application ……

Page 11: Mule 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 12: Mule stored procedure

Conclusion

Page 13: Mule 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 14: Mule 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 15: Mule stored procedure

Thank You