Connect to a database through SSL using DB connector and a datasource connection
Since the DB connector does not provide an OOTB way to connect to a database through SSL, this article provides an alternative approach on how to do it.
1. Create a simple application in Anypoint Studio
2. Refer to Spring based datasources, MULE 4 section.
3. By now you should have imported Spring Module, created a file like spring-config.xml under src/main/resources and refer to that file.
4. After that, you need to configure the beans inside spring-config.xml. Here is an example of how spring-config.xml should look like (make sure to include every namespace):
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
http://www.springframework.org/schema/jdbc
http://www.springframework.org/schema/jdbc/spring-jdbc-4.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.2.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-4.2.xsd">
<bean id="dataSource" class="oracle.jdbc.pool.OracleDataSource" destroy-method="close">
<property name="driverType" value="oracle.jdbc.driver.OracleDriver" />
<property name="URL" value='jdbc:oracle:thin:@(DESCRIPTION= (ADDRESS=(PROTOCOL=TCPS)(PORT=1522)(HOST=<HOST>))(CONNECT_DATA=(SERVICE_NAME=<SERVICE_NAME>))(SECURITY = (SSL_SERVER_CERT_DN = "<SSL_CERVER_CERT_DN>")))' />
<property name="User" value="<USER>" />
<property name="Password" value="<PASSWORD>" />
<property name="ConnectionProperties">
<value>
javax.net.ssl.trustStore:<PATH_TO_TRUSTSTORE>
javax.net.ssl.trustStoreType:<TRUSTSTORE_TYPE>
javax.net.ssl.trustStorePassword:<TRUSTSTORE_PASSWORD>
</value>
</property>
</bean>
</beans>
What do bold fields mean?
Note: for 2-way SSL, you need to add the following properties as well:
5. Now with the datasource properly configured, add the DB connector to the canvas.
6. Go to Global Elements --> Database Config --> General tab and Select Data Source Reference Connection
7. Add the driver of your choice (make sure it supports connections over SSL, otherwise it won't work)
8. Fill the Data source ref with the value of id of point 4. (datasource) in this example.
Now you are set and ready to test the connection. The motivation of this approach is to be used in Cloudhub where overriding the javax.net.ssl.trustStore property is not an option since it removes all existing certificates. However, it can be applied in on-prem environments as well.
For a sample Spring bean configuration for DB2, refer to the following article:
Disclaimer: This solution provides a suggestion that should be considered in conjunction with your specific use-case and requirements and does not represent a complete solution for all circumstances.
001116341

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.