Contact Free trial Login

Database Connector - Get Started - Mule 4

Support Category: Select

Database Connector Version 1.8

Anypoint Connector for Database (Database Connector) establishes communication between your Mule app and a relational database.

Database Connector can connect to almost any Java Database Connectivity (JDBC) relational database and run SQL operations. You can specify Dataweave expressions in connector fields and configure attributes dynamically, depending on the database configuration you use. An application can support multi-tenant scenarios using the same configuration element, changing the connection attributes based on, for example, information coming from each request.

You can perform predefined queries, dynamically constructed queries, and template queries that are self-sufficient and customizable. You can perform multiple SQL requests in a single bulk update and make Data Definition Language (DDL) requests that alter the data structure rather than the data itself.

About Connectors

Anypoint connectors are Mule runtime engine extensions that enable you to connect to APIs and resources on external systems, such as Salesforce, Database, ServiceNow, and Twitter.


Before creating an app, you must have access to the database target resource and Anypoint Platform. You must also understand how to create a Mule app using Flow Designer or Anypoint Studio.

Supported Database Types

The Database Connector has connection providers that automatically set the driver class name and create JDBC URLs with the given parameters for the following databases:

  • MySQL

  • Oracle

  • Microsoft SQL Server

You can set up other JDBC databases using a generic JDBC configuration. You can also reference a JDBC DataSource object or a XADataSource object, which is required for XA transactions. You typically create the object in Studio using Spring.

Database Listeners and Operations

The Database connector provides a listener to read from a database in the data source section of a flow. You can execute other operations to read and write to a database anywhere in the Process section. For example, instead of writing single records to a database, bulk operations allow you to modify a collection of records by supplying the SQL to modify each record in the collection.

Other operations allow you to carry out Data Definition Language (DDL) operations, execute stored procedures, or execute entire SQL scripts at once.


Exchange Templates and Examples

Anypoint Exchange provides templates you can use as a starting point for your app, as well as examples that illustrate a complete solution:


After you have met the prerequisites and experimented with templates and examples, you are ready to create an app with Design Center or Anypoint Studio.