SlideShare a Scribd company logo
1 of 7
MuleESB : Fetch Records from
Mysql
In this tutorial we are going to fetch the records
from Mysql Table by using MySql Database
connector with select operation
Pre-requisites :
1.Anypoint Studio 5.2.0
2.Mule Server 3.7.0/3.7.1
3.Mysql Database v6.x
4.Database Table script
MySql Table Script :
CREATE DATABASE IF NOT EXISTS `muleesb`;
USE `muleesb`;
DROP TABLE IF EXISTS `ESB_version`;
CREATE TABLE `ESB_version` (
`server_id` int(11) NOT NULL AUTO_INCREMENT,
`server_version` varchar(45) DEFAULT NULL,
`release_date` datetime DEFAULT NULL,
PRIMARY KEY (`server_id`),
KEY `index1` (`server_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
LOCK TABLES `ESB_version` WRITE;
INSERT INTO `ESB_version` VALUES (1,'3.7.0','2015-07-07 00:00:00'),(2,'3.7.0','2015-
07-07 00:00:00'),(3,'3.7.0','2015-07-07 00:00:00'),(4,'3.7.0','2015-07-07 00:00:00');
UNLOCK TABLES;
Mule Flow :
In the above flow i am fetching the table data from database connector as
ArrayList and this is list is converted to JSON string in the last transformer and
the JSON will be returned to the calling http request .
Mule Source xml :
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0"
port="8081" doc:name="HTTP Listener Configuration"/>
<db:mysql-config name="MySQL_Configuration" host="127.0.0.1" port="3306"
user="anil" password="anil" database="muleesb" doc:name="MySQL
Configuration"/>
<flow name="fetchmysqldataFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/"
doc:name="HTTP"/>
<db:select config-ref="MySQL_Configuration" doc:name="Database">
<db:parameterized-query><![CDATA[select * from
muleesb.ESB_version]]></db:parameterized-query>
</db:select>
<logger message="no of records fetched : #[payload.size()]" level="INFO"
doc:name="Logger"/>
<json:object-to-json-transformer mimeType="application/json"
doc:name="Object to JSON"/></flow>
Flow Request :
http://localhost:8081
Flow Response:
[{"server_version":"3.7.0","release_date":1436207400000,"server_id":1},
{"server_version":"3.7.0","release_date":1436207400000,"server_id":2},
{"server_version":"3.7.0","release_date":1436207400000,"server_id":3},
{"server_version":"3.7.0","release_date":1436207400000,"server_id":4}]
Flow Request :
http://localhost:8081
Flow Response:
[{"server_version":"3.7.0","release_date":1436207400000,"server_id":1},
{"server_version":"3.7.0","release_date":1436207400000,"server_id":2},
{"server_version":"3.7.0","release_date":1436207400000,"server_id":3},
{"server_version":"3.7.0","release_date":1436207400000,"server_id":4}]

More Related Content

What's hot

mysql replication
mysql replicationmysql replication
mysql replication
blus4uuu
 
Cloudcamp scotland - Using cloud without losing control
Cloudcamp scotland - Using cloud without losing controlCloudcamp scotland - Using cloud without losing control
Cloudcamp scotland - Using cloud without losing control
Duncan Johnston-Watt
 
zookeeperProgrammers
zookeeperProgrammerszookeeperProgrammers
zookeeperProgrammers
Hiroshi Ono
 

What's hot (18)

Cyansible
CyansibleCyansible
Cyansible
 
My sql failover test using orchestrator
My sql failover test  using orchestratorMy sql failover test  using orchestrator
My sql failover test using orchestrator
 
AWS ECSを用いてbatchを動かそう
AWS ECSを用いてbatchを動かそうAWS ECSを用いてbatchを動かそう
AWS ECSを用いてbatchを動かそう
 
Zookeeper In Action
Zookeeper In ActionZookeeper In Action
Zookeeper In Action
 
mysql replication
mysql replicationmysql replication
mysql replication
 
Bkbiet day2 & 3
Bkbiet day2 & 3Bkbiet day2 & 3
Bkbiet day2 & 3
 
Ansible101
Ansible101Ansible101
Ansible101
 
Cloudcamp scotland - Using cloud without losing control
Cloudcamp scotland - Using cloud without losing controlCloudcamp scotland - Using cloud without losing control
Cloudcamp scotland - Using cloud without losing control
 
PuppetConf 2016: Puppet and UCS: Policy-Based Management All the Way Down – C...
PuppetConf 2016: Puppet and UCS: Policy-Based Management All the Way Down – C...PuppetConf 2016: Puppet and UCS: Policy-Based Management All the Way Down – C...
PuppetConf 2016: Puppet and UCS: Policy-Based Management All the Way Down – C...
 
Database Schema as Code
Database Schema as CodeDatabase Schema as Code
Database Schema as Code
 
Monitor your CentOS stack with Prometheus
Monitor your CentOS stack with PrometheusMonitor your CentOS stack with Prometheus
Monitor your CentOS stack with Prometheus
 
Jenkins X on AKS
Jenkins X on AKSJenkins X on AKS
Jenkins X on AKS
 
Awx
AwxAwx
Awx
 
Build, Deploy and Manage Your Releases Like a Boss
Build, Deploy and Manage Your Releases Like a BossBuild, Deploy and Manage Your Releases Like a Boss
Build, Deploy and Manage Your Releases Like a Boss
 
Creating a Mesos python framework
Creating a Mesos python frameworkCreating a Mesos python framework
Creating a Mesos python framework
 
zookeeperProgrammers
zookeeperProgrammerszookeeperProgrammers
zookeeperProgrammers
 
Fact-Based Monitoring - PuppetConf 2014
Fact-Based Monitoring - PuppetConf 2014Fact-Based Monitoring - PuppetConf 2014
Fact-Based Monitoring - PuppetConf 2014
 
DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'
DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'
DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'
 

Viewers also liked

Mule ESB Tutorial Part 3
Mule ESB Tutorial Part 3Mule ESB Tutorial Part 3
Mule ESB Tutorial Part 3
Srikanth N
 

Viewers also liked (14)

Mule concepts flows
Mule concepts flowsMule concepts flows
Mule concepts flows
 
Mule concepts components
Mule concepts componentsMule concepts components
Mule concepts components
 
Mule message
Mule messageMule message
Mule message
 
Mule ESB Fundamentals
Mule ESB FundamentalsMule ESB Fundamentals
Mule ESB Fundamentals
 
Mule ESB - Integration Simplified
Mule ESB - Integration SimplifiedMule ESB - Integration Simplified
Mule ESB - Integration Simplified
 
Mule esb - How to connect to a MySql Database in 5 minutes
Mule esb - How to connect to a MySql Database in 5 minutesMule esb - How to connect to a MySql Database in 5 minutes
Mule esb - How to connect to a MySql Database in 5 minutes
 
Mule security - jaas
Mule  security - jaasMule  security - jaas
Mule security - jaas
 
Mule integration-application
Mule integration-applicationMule integration-application
Mule integration-application
 
Webservice vm in mule
Webservice vm in muleWebservice vm in mule
Webservice vm in mule
 
Mule ESB Tutorial Part 3
Mule ESB Tutorial Part 3Mule ESB Tutorial Part 3
Mule ESB Tutorial Part 3
 
Mule esb basic introduction
Mule esb basic introductionMule esb basic introduction
Mule esb basic introduction
 
Future of Integration | MuleSoft
Future of Integration | MuleSoftFuture of Integration | MuleSoft
Future of Integration | MuleSoft
 
Mule ESB Tutorial Part 1
Mule ESB Tutorial Part 1Mule ESB Tutorial Part 1
Mule ESB Tutorial Part 1
 
Application Architecture: The Next Wave | MuleSoft
Application Architecture: The Next Wave | MuleSoftApplication Architecture: The Next Wave | MuleSoft
Application Architecture: The Next Wave | MuleSoft
 

Similar to Fetch records from mysql using mule esb

Interfacing python to mysql (11363255151).pptx
Interfacing python to mysql (11363255151).pptxInterfacing python to mysql (11363255151).pptx
Interfacing python to mysql (11363255151).pptx
cavicav231
 
9780538745840 ppt ch08
9780538745840 ppt ch089780538745840 ppt ch08
9780538745840 ppt ch08
Terry Yoast
 
Based on the materials for this week, create your own unique Datab.docx
Based on the materials for this week, create your own unique Datab.docxBased on the materials for this week, create your own unique Datab.docx
Based on the materials for this week, create your own unique Datab.docx
JASS44
 
MySQL cluster 72 in the Cloud
MySQL cluster 72 in the CloudMySQL cluster 72 in the Cloud
MySQL cluster 72 in the Cloud
Marco Tusa
 

Similar to Fetch records from mysql using mule esb (20)

Mule esb db component
Mule esb db componentMule esb db component
Mule esb db component
 
MySQL Basics
MySQL BasicsMySQL Basics
MySQL Basics
 
MySql:Basics
MySql:BasicsMySql:Basics
MySql:Basics
 
MySql:Introduction
MySql:IntroductionMySql:Introduction
MySql:Introduction
 
MySQL Introduction
MySQL IntroductionMySQL Introduction
MySQL Introduction
 
Advance Mobile Application Development class 01
Advance Mobile Application Development class 01Advance Mobile Application Development class 01
Advance Mobile Application Development class 01
 
Linuxfest Northwest 2022 - MySQL 8.0 Nre Features
Linuxfest Northwest 2022 - MySQL 8.0 Nre FeaturesLinuxfest Northwest 2022 - MySQL 8.0 Nre Features
Linuxfest Northwest 2022 - MySQL 8.0 Nre Features
 
Interfacing python to mysql (11363255151).pptx
Interfacing python to mysql (11363255151).pptxInterfacing python to mysql (11363255151).pptx
Interfacing python to mysql (11363255151).pptx
 
Mysql all
Mysql allMysql all
Mysql all
 
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source SummitMySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
 
Html web sql database
Html web sql databaseHtml web sql database
Html web sql database
 
PHP with MySQL
PHP with MySQLPHP with MySQL
PHP with MySQL
 
9780538745840 ppt ch08
9780538745840 ppt ch089780538745840 ppt ch08
9780538745840 ppt ch08
 
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptJavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
 
Chef
ChefChef
Chef
 
Chef solo the beginning
Chef solo the beginning Chef solo the beginning
Chef solo the beginning
 
Based on the materials for this week, create your own unique Datab.docx
Based on the materials for this week, create your own unique Datab.docxBased on the materials for this week, create your own unique Datab.docx
Based on the materials for this week, create your own unique Datab.docx
 
MySQL cluster 72 in the Cloud
MySQL cluster 72 in the CloudMySQL cluster 72 in the Cloud
MySQL cluster 72 in the Cloud
 
Node.js with MySQL.pdf
Node.js with MySQL.pdfNode.js with MySQL.pdf
Node.js with MySQL.pdf
 
Python with MySql.pptx
Python with MySql.pptxPython with MySql.pptx
Python with MySql.pptx
 

More from AnilKumar Etagowni (9)

Spring introduction
Spring introductionSpring introduction
Spring introduction
 
Mule ESB : ssh connector
Mule ESB : ssh connectorMule ESB : ssh connector
Mule ESB : ssh connector
 
Mule esb data weave multi input data
Mule esb data weave multi input dataMule esb data weave multi input data
Mule esb data weave multi input data
 
Mule esb :Data Weave
Mule esb :Data WeaveMule esb :Data Weave
Mule esb :Data Weave
 
Mule ESB SMTP Connector Integration
Mule ESB SMTP Connector  IntegrationMule ESB SMTP Connector  Integration
Mule ESB SMTP Connector Integration
 
Box connector Mule ESB Integration
Box connector Mule ESB IntegrationBox connector Mule ESB Integration
Box connector Mule ESB Integration
 
Dropbox connector Mule ESB Integration
Dropbox connector Mule ESB IntegrationDropbox connector Mule ESB Integration
Dropbox connector Mule ESB Integration
 
Web service invocation in mule
Web service invocation in muleWeb service invocation in mule
Web service invocation in mule
 
Running ms sql stored procedures in mule
Running ms sql stored procedures in muleRunning ms sql stored procedures in mule
Running ms sql stored procedures in mule
 

Recently uploaded

Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Recently uploaded (20)

Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 

Fetch records from mysql using mule esb

  • 1. MuleESB : Fetch Records from Mysql
  • 2. In this tutorial we are going to fetch the records from Mysql Table by using MySql Database connector with select operation Pre-requisites : 1.Anypoint Studio 5.2.0 2.Mule Server 3.7.0/3.7.1 3.Mysql Database v6.x 4.Database Table script
  • 3. MySql Table Script : CREATE DATABASE IF NOT EXISTS `muleesb`; USE `muleesb`; DROP TABLE IF EXISTS `ESB_version`; CREATE TABLE `ESB_version` ( `server_id` int(11) NOT NULL AUTO_INCREMENT, `server_version` varchar(45) DEFAULT NULL, `release_date` datetime DEFAULT NULL, PRIMARY KEY (`server_id`), KEY `index1` (`server_id`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; LOCK TABLES `ESB_version` WRITE; INSERT INTO `ESB_version` VALUES (1,'3.7.0','2015-07-07 00:00:00'),(2,'3.7.0','2015- 07-07 00:00:00'),(3,'3.7.0','2015-07-07 00:00:00'),(4,'3.7.0','2015-07-07 00:00:00'); UNLOCK TABLES;
  • 4. Mule Flow : In the above flow i am fetching the table data from database connector as ArrayList and this is list is converted to JSON string in the last transformer and the JSON will be returned to the calling http request .
  • 5. Mule Source xml : <http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/> <db:mysql-config name="MySQL_Configuration" host="127.0.0.1" port="3306" user="anil" password="anil" database="muleesb" doc:name="MySQL Configuration"/> <flow name="fetchmysqldataFlow"> <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/> <db:select config-ref="MySQL_Configuration" doc:name="Database"> <db:parameterized-query><![CDATA[select * from muleesb.ESB_version]]></db:parameterized-query> </db:select> <logger message="no of records fetched : #[payload.size()]" level="INFO" doc:name="Logger"/> <json:object-to-json-transformer mimeType="application/json" doc:name="Object to JSON"/></flow>
  • 6. Flow Request : http://localhost:8081 Flow Response: [{"server_version":"3.7.0","release_date":1436207400000,"server_id":1}, {"server_version":"3.7.0","release_date":1436207400000,"server_id":2}, {"server_version":"3.7.0","release_date":1436207400000,"server_id":3}, {"server_version":"3.7.0","release_date":1436207400000,"server_id":4}]
  • 7. Flow Request : http://localhost:8081 Flow Response: [{"server_version":"3.7.0","release_date":1436207400000,"server_id":1}, {"server_version":"3.7.0","release_date":1436207400000,"server_id":2}, {"server_version":"3.7.0","release_date":1436207400000,"server_id":3}, {"server_version":"3.7.0","release_date":1436207400000,"server_id":4}]