Continuing from the previous post, here we configure a database connector.
1) From clicking the green plus button in the Database element general configuration page.
- Derby Configuration
- Generic Database Configuration
- MySQL Configuration
- Oracle Configuration
Select the option that is appropriate for your database.
Example for MySQL Configuration
The below is an example MySQL Configuration (click to enlarge):
- Name:
- Database configuration parameters:
- Host: ${mysql.server}
- Port: 3306
- User: ${mysql.user}
- Password: ${mysql.password}
- Database: default_database
- MySQL Driver:
Note: Where we have ${VARIABLE_NAME}, this allows your to provide inputs to your Mule Application (i.e. if you have multiple MySQL servers to connect to, you don't need different Mule Applications just because the name of the MySQL server changes for instance.)
Advanced tab:
Based on a known working config (no screenshot for this), the settings (in bold) are:
- Use XA Transactions - UNTICKED
- Connection Timeout: BLANK
- Transaction isolation:
- NONE (Default)
- READ_COMMITTED
- READ_UNCOMMITTED
- REPEATABLE_READ
- SERIALIZABLE
- Advanced Parameters: BLANK
- Connection Pooling:
- Max Pool Size: BLANK
- Min Pool Size: BLANK
- Acquire Increment: BLANK
- Prepared Statement Cache Size: BLANK
- Max Wait Millis: BLANK
Reconnection tab:
Based on a known working config (no screenshot for this), the settings (in bold) are:
- Standard Reconnection:
- Frequency (ms): 2000
- Reconnection Attempts: 2
- Reconnect Forever: TICKED
Example of the MySQL Database Configuration: 1 - Stored Procedure
In the screenshot below, I've blanked some things out, but you get the idea of how using the MySQL connector with a Stored Procedure and some input variables would look (click to enlarge):
Example of the MySQL Database Configuration: 2 - Parameterized Query
In the below you see we are using the #[payload.variable] syntax to get information from the payload.
Example of the MySQL Database Configuration: 3 - sessionVars
In the below you see we are using #[sessionvars.variable] syntax to get information for a session variable.
Example for Generic Database Configuration
The below is an example for a 'Generic Database connector' (click to enlarge):
- Name: opsCenterServer
- Database URL:
- URL: jdbc:sybase:Tds:${opsCenter.server}:${opsCenter.port}/vxpmdb?User=${opsCenter.user}&Password=${opsCenter.password}
- Driver Class Name: com.sybase.jdbc4.jdbc.SybDriver
The 'Advanced tab' and 'Reconnection tab' settings were pretty much just the same as the MySQL connector above (except not set to reconnect in this instance.)
Example of the Generic Database Configuration:
In the screenshot below, you get the idea of how using the Generic Database connector with a parameterized query (a simple OpsCenter query) would look (click to enlarge):
Comments
Post a Comment