user25347040
user25347040

Reputation: 11

Rust oracle mtls connection

How to connect to Oracle database which is enabled with mTLS?

I tried using rust oracle crate but wasn't successful. Please suggest/help on this. The idea is to connect to oracle DB and extract some data but since it is mtls enabled, I'm not able to establish connection.

Upvotes: 1

Views: 50

Answers (1)

Christopher Jones
Christopher Jones

Reputation: 10506

I assume this is a question about connecting to Oracle Autonomous Database using rust-oracle.

Follow the general techniques for other Oracle 'thick' mode drivers that utilize Oracle Client libraries, for example see the 'Thick mode' sections of the python-oracledb documentation.

  1. Make sure to download the correct mTLS wallet from the Oracle ADB cloud console

  2. Unzip the wallet file. You just need three files:

    • tnsnames.ora - Maps net service names used for application connection strings to your database services
    • sqlnet.ora - Configures Oracle Network settings
    • cwallet.sso - Enables SSL/TLS connections in Thick mode. Keep this file secure

You then have two options:

  1. Either move the extracted files to a default location, such as in the Instant Client network/admin subdirectory.
  2. Or the second option is to move the extracted files to a central location. Then edit the file sqlnet.ora to set the wallet location DIRECTORY path to the directory where the files are. Then set the TNS_ADMIN environment variable to that same directory name.

With either option, you would then just run your app using one of the connection aliases in the tnsnames.ora file (along with your database username and password):

let conn = Connection::connect("scott", "tiger", "mydb_high")?;

Upvotes: 0

Related Questions