Contact Free trial Login

Switch the Connection That a Connector is Using in a Project

Every connector that you include in a flow in a Mule-app project uses a connection to connect at runtime to a system. A connection is a saved set of information that a running Mule app must use to connect to a specific system by means of a connector. For example, you configure a Salesforce connector to use a specific connection to Salesforce, an instance of Database Connector to use a specific connection to a database.

You can change a configuration to use a different connection or you can create and use a configuration that uses a different connection.

For example, suppose that you add an instance of Database Connector to a flow. When you create configuration Config 1 for it, you create Connection MySQL to specify the information that the your Mule app needs to connect to a MySQL database at runtime. Now, you want to test your Mule app against an Oracle database.

Because the configuration for the Oracle database requires not only a separate connection but also different additional information, you create the configuration Config 2 and the connection Oracle. Then, you switch to using Config 2.

The Advanced section of Database Connector
Figure 1. For every configuration that you create for a connector, you can use the Advanced section to specify information in addition to the connection for the configuration to use.
1 The text to click to open the Advanced section
2 The additional information that you can specify for the instance of Database Connector

This diagram depicts the switch from Config 1 to Config 2:

Switching configurations to switch connections
Figure 2. This diagram shows that you can switch from one configuration to another to switch connections.

In this next diagram, the instance of Database Connector is using the configuration Config 1, which uses connection MySQL1. If you want to switch to a different MySQL database and connecting to the database does not require any differences in the information that the configuration provides, you can simply change the configuration to use the connection MySQL2.

Switching connections in a configuration
Figure 3. This diagram shows that you can switch connections in a configuration.

To Switch the Connection That a Connector is Using in a Project:

  • If you want to switch connections and the configuration requires different additional information, create a configuration that uses the connection you want to switch to.

    1. Open the card that represents the connector that you need to switch to a different connection.

    2. At the top of the card, click Switch configurations.

    3. Click Add.

    4. Create the new configuration, selecting or creating the connection that you want to use, and click Save.

    Result: The Connector configuration area of the card shows that the new configuration is selected. Also, the configuration is listed in the Reusable Configurations section of the Project pane on the left side of the canvas. Click Back.

  • If you want to switch connections and the configuration does not require different additional information, edit the configuration to use the connection that you want to switch to.

    1. In the Reusable Configurations section of the Project pane on the left side of the canvas, click the configuration that you want to edit.

    2. Select or create the connection that you want to use.

    3. Click Save.

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub