SlideShare a Scribd company logo
DATABASE INTEGRATE
WITH MULE
MULE HAS INTRODUCED IT’S NEW JDBC COMPONENT
RECENTLY WHICH ALLOW USTO CONNECT ALMOST WITH
ALMOST ANY JAVA DATABASE CONNECTIVITY (JDBC)
RELATIONAL DATABASE USING A SINGLE INTERFACE FOR
EVERY CASE.
IT ALSO RUN DIVERSE SQL OPERATIONS ON OUR DATABASE,
INCLUDING SELECT, INSERT, UPDATE, DELETE, AND EVEN
STORED PROCEDURES.
SOWE CAN SAYTHAT ALMOST ALLTYPE OF DB OPERATION
CAN BE DONE HERE SMOOTHLY WITHTHIS NEW COMPONENT
We I will give you few small demo here on how to operate with this new
component.
Let’s consider we have the following simple Mule flow :-
As you can see we have used the new DB connecter to fetch the Data from
Database and display the data in an XML format in logger
The new Database component is of 3 query type :
• Parameterized
• Dynamic
• FromTemplate
For more info.. Please visit :-
http://www.mulesoft.org/documentation/display/current/Database+C
onnector
Configuring the Database
For configuring the database, we need to configure the global database connector
with your existing DB as follows :-
<db:generic-config name="Generic_Database_Configuration"
url="jdbc:sqlserver://ANIRBAN-
PCSQLEXPRESS:1433;databaseName=Anirban;user=sa;password=******"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
doc:name="Generic DatabaseConfiguration" />
The above code is a sample of connecting Mule with SQL server database.
Now there are various ways to use this new component….
I will show you small examples here
Configuring a From-Template Query
You can use a template to pre-define an SQL query that you can
use and reuse in your application's flows.
It enables you to define a query statement once, in a global element
in your application (globalTemplate Query ), then reuse the query
multiple times whenever required
<db:template-query name=“simpleQuery" doc:name="Template Query">
<db:parameterized-query >select * from table1 </db:parameterized-query>
</db:template-query>
<db:select config-ref="Generic_Database_Configuration"
doc:name="Database">
<db:template-query-ref name="withoutParameter"/>
</db:select>
And referring the template in the Mule flow as follows :-
Dynamic query :
Mule replaces all MEL expressions in the query with the result of the
expression evaluation, then sends the result to the database. As such, you are
responsible for making sure that any string in your query statement is
interpretable by the database (i.e. quoting strings, data formatting, etc.)
<db:select config-ref="Generic_Database_Configuration" doc:name="Database">
<db:dynamic-query><![CDATA[select * from table1]]>
</db:dynamic-query>
</db:select>
Above example shows the use of dynamic query
Parameterized query :
Mule replaces all Mule Expression Language (MEL) expressions inside a query
with "?" to create a prepared statement, then evaluates the MEL expressions
using the current event so as to obtain the value for each parameter.
<db:select config-ref="Generic_Database_Configuration" doc:name="Database">
<db:parameterized-query><![CDATA[select * from table1 where
Id=23]]></db:parameterized-query>
</db:select>
Above example shows the use of Parameterized query
Stored procedure:
This new jdbc component can also execute stored procedure as follows :-
<db:stored-procedure config-ref="Generic_Database_Configuration">
<db:parameterized-query>{ call selectData() }</db:parameterized-query>
</db:stored-procedure>
Above example shows the use of stored procedure where selectData() is a stored
procedure

More Related Content

PPTX
Stored procedure in mule
PPTX
Mule with stored procedure
PPTX
Mapping and listing in mule
PPTX
Stored Procedure With In Out Parameters in Mule 3.6
PPTX
Mapping and listing with mule
PDF
Connecting To MS SQL Server With Mulesoft (Stored Procedure To Insert data)
PPTX
Integrate with database by groovy
PPTX
Mule xml transformation
Stored procedure in mule
Mule with stored procedure
Mapping and listing in mule
Stored Procedure With In Out Parameters in Mule 3.6
Mapping and listing with mule
Connecting To MS SQL Server With Mulesoft (Stored Procedure To Insert data)
Integrate with database by groovy
Mule xml transformation

What's hot (20)

PPTX
Mule database connector
PPTX
DataBase Connectivity
PPTX
Java database connectivity
PPTX
MuleSoft ESB - CSV File to Database
PPTX
Mule mel 5_tips
PPTX
Mule esb :Data Weave
PPTX
My sql with java
PPTX
JDBC ppt
PPTX
Parameters as a part of body
PDF
MuleSoft ESB Message Enricher
DOCX
Query transport problems
DOCX
Mule with jdbc(my sql)
PPTX
Mule jdbc
PPTX
Lecture 1. java database connectivity
PPTX
Mule new jdbc component
PPTX
Caching and invalidating with managed store
PPTX
Mule with drools
 
Mule database connector
DataBase Connectivity
Java database connectivity
MuleSoft ESB - CSV File to Database
Mule mel 5_tips
Mule esb :Data Weave
My sql with java
JDBC ppt
Parameters as a part of body
MuleSoft ESB Message Enricher
Query transport problems
Mule with jdbc(my sql)
Mule jdbc
Lecture 1. java database connectivity
Mule new jdbc component
Caching and invalidating with managed store
Mule with drools
 
Ad

Viewers also liked (6)

PPTX
Input and output flow using http and java component
PPTX
Sending mail in mule
PPTX
Input and output flow with logger component
PPTX
Integrate to retrieve data microsoft azure
PPTX
Basic example using file connector in anypoint studio
PDF
H2O - the optimized HTTP server
Input and output flow using http and java component
Sending mail in mule
Input and output flow with logger component
Integrate to retrieve data microsoft azure
Basic example using file connector in anypoint studio
H2O - the optimized HTTP server
Ad

Similar to Database integrate with mule (20)

PPTX
PDF
OpenDMS - the first 2 weeks
PPT
Java Developers, make the database work for you (NLJUG JFall 2010)
PDF
Introduction to sql server
PPTX
MyBatis
PPTX
Liquibase for java developers
PPTX
Sql interview question part 12
PPTX
Ebook12
PPTX
Sql interview question part 12
PPTX
introduction to SQL query language beginner.ppt
PPTX
Mule connectors-session1
PPTX
TSQL in SQL Server 2012
PPT
Ebook8
PPT
Sql interview question part 8
PPT
Mule database connector
PPTX
Mule connectors-part 1
PPTX
Mule ESB Components
PPTX
Mule data bases
PPTX
J2EE pattern 5
PDF
Overview Of JDBC
OpenDMS - the first 2 weeks
Java Developers, make the database work for you (NLJUG JFall 2010)
Introduction to sql server
MyBatis
Liquibase for java developers
Sql interview question part 12
Ebook12
Sql interview question part 12
introduction to SQL query language beginner.ppt
Mule connectors-session1
TSQL in SQL Server 2012
Ebook8
Sql interview question part 8
Mule database connector
Mule connectors-part 1
Mule ESB Components
Mule data bases
J2EE pattern 5
Overview Of JDBC

More from Son Nguyen (20)

PPTX
Wsdl connector introduction
PPTX
Android intergrate with mule
PPTX
Mule flow overview
PPTX
Mule flow and filter
PPTX
Handle exceptions in mule
PPT
Spring security integrate with mule
PPTX
Message processor in mule
PPTX
Expression language in mule
PPTX
Mule with data weave
PPTX
Using spring scheduler mule
PPTX
Composite source in bound and out-bound
PPT
Batch job processing
PPTX
Using message enricher
PPT
Finance connectors with mule
PPT
Google drive connection
PPTX
Using properties in mule
PPT
Mule integrate with microsoft
PPTX
Jms queue
PPT
Anypoint connectors
PPTX
Mule esb basic introduction
Wsdl connector introduction
Android intergrate with mule
Mule flow overview
Mule flow and filter
Handle exceptions in mule
Spring security integrate with mule
Message processor in mule
Expression language in mule
Mule with data weave
Using spring scheduler mule
Composite source in bound and out-bound
Batch job processing
Using message enricher
Finance connectors with mule
Google drive connection
Using properties in mule
Mule integrate with microsoft
Jms queue
Anypoint connectors
Mule esb basic introduction

Recently uploaded (20)

PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Advanced Soft Computing BINUS July 2025.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
madgavkar20181017ppt McKinsey Presentation.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Transforming Manufacturing operations through Intelligent Integrations
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
Electronic commerce courselecture one. Pdf
PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Modernizing your data center with Dell and AMD
PPTX
Big Data Technologies - Introduction.pptx
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
20250228 LYD VKU AI Blended-Learning.pptx
Advanced Soft Computing BINUS July 2025.pdf
Empathic Computing: Creating Shared Understanding
GamePlan Trading System Review: Professional Trader's Honest Take
The Rise and Fall of 3GPP – Time for a Sabbatical?
MYSQL Presentation for SQL database connectivity
Spectral efficient network and resource selection model in 5G networks
madgavkar20181017ppt McKinsey Presentation.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Advanced methodologies resolving dimensionality complications for autism neur...
Transforming Manufacturing operations through Intelligent Integrations
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
Electronic commerce courselecture one. Pdf
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Dropbox Q2 2025 Financial Results & Investor Presentation
Modernizing your data center with Dell and AMD
Big Data Technologies - Introduction.pptx
NewMind AI Monthly Chronicles - July 2025
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows

Database integrate with mule

  • 2. MULE HAS INTRODUCED IT’S NEW JDBC COMPONENT RECENTLY WHICH ALLOW USTO CONNECT ALMOST WITH ALMOST ANY JAVA DATABASE CONNECTIVITY (JDBC) RELATIONAL DATABASE USING A SINGLE INTERFACE FOR EVERY CASE. IT ALSO RUN DIVERSE SQL OPERATIONS ON OUR DATABASE, INCLUDING SELECT, INSERT, UPDATE, DELETE, AND EVEN STORED PROCEDURES. SOWE CAN SAYTHAT ALMOST ALLTYPE OF DB OPERATION CAN BE DONE HERE SMOOTHLY WITHTHIS NEW COMPONENT
  • 3. We I will give you few small demo here on how to operate with this new component. Let’s consider we have the following simple Mule flow :- As you can see we have used the new DB connecter to fetch the Data from Database and display the data in an XML format in logger
  • 4. The new Database component is of 3 query type : • Parameterized • Dynamic • FromTemplate For more info.. Please visit :- http://www.mulesoft.org/documentation/display/current/Database+C onnector
  • 5. Configuring the Database For configuring the database, we need to configure the global database connector with your existing DB as follows :- <db:generic-config name="Generic_Database_Configuration" url="jdbc:sqlserver://ANIRBAN- PCSQLEXPRESS:1433;databaseName=Anirban;user=sa;password=******" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" doc:name="Generic DatabaseConfiguration" /> The above code is a sample of connecting Mule with SQL server database.
  • 6. Now there are various ways to use this new component…. I will show you small examples here
  • 7. Configuring a From-Template Query You can use a template to pre-define an SQL query that you can use and reuse in your application's flows. It enables you to define a query statement once, in a global element in your application (globalTemplate Query ), then reuse the query multiple times whenever required <db:template-query name=“simpleQuery" doc:name="Template Query"> <db:parameterized-query >select * from table1 </db:parameterized-query> </db:template-query> <db:select config-ref="Generic_Database_Configuration" doc:name="Database"> <db:template-query-ref name="withoutParameter"/> </db:select> And referring the template in the Mule flow as follows :-
  • 8. Dynamic query : Mule replaces all MEL expressions in the query with the result of the expression evaluation, then sends the result to the database. As such, you are responsible for making sure that any string in your query statement is interpretable by the database (i.e. quoting strings, data formatting, etc.) <db:select config-ref="Generic_Database_Configuration" doc:name="Database"> <db:dynamic-query><![CDATA[select * from table1]]> </db:dynamic-query> </db:select> Above example shows the use of dynamic query
  • 9. Parameterized query : Mule replaces all Mule Expression Language (MEL) expressions inside a query with "?" to create a prepared statement, then evaluates the MEL expressions using the current event so as to obtain the value for each parameter. <db:select config-ref="Generic_Database_Configuration" doc:name="Database"> <db:parameterized-query><![CDATA[select * from table1 where Id=23]]></db:parameterized-query> </db:select> Above example shows the use of Parameterized query
  • 10. Stored procedure: This new jdbc component can also execute stored procedure as follows :- <db:stored-procedure config-ref="Generic_Database_Configuration"> <db:parameterized-query>{ call selectData() }</db:parameterized-query> </db:stored-procedure> Above example shows the use of stored procedure where selectData() is a stored procedure