Loading

How to connect to Oracle Database over TCPS protocol

Udgivelsesdato: Mar 2, 2024
Løsning

QUESTION

How to connect to Oracle Database over TCPS protocol

ANSWER

Assume you already have configured Oracle DB and it is enabled to work with TCPS protocol, you can validate it running the following command:
SQL> select sys_context('userenv','network_protocol') from dual;
SYS_CONTEXT('USERENV','NETWORK_PROTOCOL')
--------------------------------------------------------------------------------
tcps


1. Since the Database connector does not provide a way to set a TLS context to provide a truststore, you need to override the default cacerts with your custom truststore JVM arguments.
In this example we will use the JKS format type for the truststore and keystore

1. a) For one way SSL
The “truststore” is used to validate the server’s certificate. Bundle the Oracle DB certificate inside a JKS truststore called truststore.jks

-Djavax.net.ssl.trustStore=<PATH>/truststore.jks
-Djavax.net.ssl.trustStoreType=JKS
-Djavax.net.ssl.trustStorePassword=password

1. b) For 2 way SSL
The “truststore” must be specified as indicated in the previous section.
Because the client now needs to be authenticated on the server, you must also specify a “keystore”. The “keystore” contains not only the client certificate which will be used for authentication but also a set of private/public keys that will be used for encryption.

-Djavax.net.ssl.trustStore=<PATH>/truststore.jks
-Djavax.net.ssl.trustStoreType=JKS
-Djavax.net.ssl.trustStorePassword=password

-Djavax.net.ssl.keyStore=<PATH>/keyStore.jks
-Djavax.net.ssl.keyStoreType=JKS
-Djavax.net.ssl.tkeyStorePassword=password

You can put the truststore and keystore files in the following path ${mule.home}/apps/${app.name}

in Runtime Fabric the JVM properties need to be set in the JVM tab of Runtime Manager

2. In the Database Configuration select "Generic Connection" in Connection type and fill in the connection details:

For example:
<db:config name="Database_Config_TCPS" doc:name="Database Config" doc:id="4ef987fe-1234-45fb-60c7-abc12345f234" >
<db:generic-connection url="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=host_name)(PORT=2484))(CONNECT_DATA=(SERVICE_NAME=ORCL)))" user="user_name" password="password" driverClassName="oracle.jdbc.driver.OracleDriver" />
</db:config>

3. Deploy the app and see if you are able to connect to the Oracle DB over TCPS protocol.


* Disclaimer: This example is provided as a reference for your own usage and is not to be considered a MuleSoft product.
This example should be considered as a custom solution. The custom solution is not a Supported MuleSoft product

 

Vidensartikelnummer

001119363

 
Indlæser
Salesforce Help | Article