Connecting to Autonomous DB Without a Wallet (Using TLS)

Enable TLS

Log in to the Oracle Cloud console and select your ADB instance to view the instance details. In the details, find the section titled ‘Network’ and click on ‘Edit’ next to ‘Access Control List’.

In the ‘Edit Access Control List’ dialog, choose the type of entry that you’d like to make and enter the appropriate value. You can add entries by IP Address (I added my local IP), CIDR Block (maybe your office has a range of IPs assigned to developers), and VCN (by name or OCID). Add as many as necessary.

Remember!  The ACL is an “allow list”, not a “deny list”. That means it blocks all traffic except for the exceptions listed.  

Disable mTLS

To use either TLS or mTLS, you must disable the requirement for mTLS. Kinda confusing, but think about it like this: If mTLS is enabled, you can only connect with mTLS. If it’s disabled, you can connect with either mTLS or TLS. 

Now uncheck ‘Require mutual TLS (mTLS) authentication’ and click ‘Save Changes’.

Obtain Connection String

Since we no longer have a tnsnames.ora file that tells the OJDBC driver how to connect to ADB, we need to grab a connection string that we can plug into our JDBC URL in the Java app. In the instance details, click on ‘DB Connection’.

In the DB connection dialog, under ‘Connection Strings’, select TLS from the dropdown menu. Then, copy the appropriate Connection String based on your application’s requirements.

Configure Java Application

In my Micronaut application, I set the following values in my configuration file (application.yml).

url: jdbc:oracle:thin:@[PASTE CONNECTION STRING] 
driverClassName: oracle.jdbc.driver.OracleDriver 
username: [USERNAME] 
password: [PASSWORD] 
dialect: ORACLE

I also made sure I had the latest OJDBC driver per the docs and launched the application. 

Launch the Application!

And that’s it. That’s all the changes I needed to make. No more wallets, no more secrets storing wallet values, no more headaches! Just a secure, encrypted connection between my app and ADB!


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.