Author: Govind Chaudhari
In this blog process design we will read the content from a file (which will be an SQL Query), then transform the file content to string and make a call to our MySQL DB and then finally display the content on the console in JSON format.
To try out the below example, you need to download and install the MYSql from if not already installed: https://dev.mysql.com/downloads/installer/
Create new mule flow:
Create a new mule flow add HTTP Lister, Dile, Database, Message Transform and Logger component to the flow.
Next, add input and output folder under src/main/resources

Create a new text file, add sql query to the text file and add the text file to the input folder.
Configure HTTP File connector as:
Specify input and output directory. File will be read from the input dir and the query will be processed.

Configure MuleSoft DB connector:


Configure transformation message component:

And finally to view the query output in the console just write “#[message.payload]” in the message box.

Run the mule application:
Run the mule application and put a file in the input folder with an sql query.

On success full run you can see the database output on the console.

Postman:
