IntelliJ IDEA 2021.3 Help

Connect to Oracle Cloud by using wallets

Oracle Wallet is a set of files that stores all the user credentials such as certificates, certificate requests, and private keys. You can create a wallet by using the Oracle tooling or ask your Oracle server administrator to generate the wallet. For more information about wallets, see Creating and Managing Oracle Wallet and Download Client Credentials (Wallets) at docs.oracle.com.

Preparing wallets and environment

From the Oracle Instant Client Downloads page at oracle.com, download the following packages for your operating system:

  • Basic Package

  • SQL*Plus Package

  • JDBC Supplement Package

Also, download oraclepki.jar from Oracle Database 12.2.0.1 JDBC Driver & UCP Downloads page at oracle.com.

Prepare a ZIP archive with wallet files. For more details about downloading a wallet, see Download Client Credentials (Wallets) at docs.oracle.com.

Step 1. Unpack and move downloaded archives and files

  1. Create a directory (for example, ~/Oracle/instantclient_19_8/).

  2. Extract all packages to the created directory.

  3. Move oraclepki.jar to the created directory.

  4. Extract a ZIP archive with wallet files to the wallet directory inside the network directory. The path to wallet files might look as follows: ~/Oracle/instantclient_19_8/network/wallet.

    path to wallet files

Step 2. Add environment variables

This procedure is optional, but it might further simplify operations with OCI.

  • Add the following environment variables:

    export ORACLE_HOME=~/Oracle/instantclient_19_8
    export TNS_ADMIN=$ORACLE_HOME/network/admin
    export NLS_LANG=English_America.UTF8
    export PATH=$PATH:$ORACLE_HOME
    set ORACLE_HOME=C:\Oracle\instantclient_19_8
    set TNS_ADMIN=%ORACLE_HOME%\network\admin
    set NLS_LANG=English_America.UTF8
    set PATH=%PATH%:%ORACLE_HOME%

Step 3. Configuring ORA files

An archive with wallet files includes tnsnames.ora and sqlnet.ora files.

  1. In the directory that you created on Step 1, create the network directory. Inside the network directory, create the admin directory. The overall path should look as follows: ~/Oracle/instantclient_19_8/network/admin.

  2. Copy tnsnames.ora and sqlnet.ora files to the admin directory.

  3. Open the sqlnet.ora file from the admin directory in the text editor.

  4. Change the value of the DIRECTORY attribute to the path to your wallet. For example, the path for this tutorial looks as follows:

    WALLET_LOCATION = (SOURCE = (METHOD = file) (METHOD_DATA = (DIRECTORY="/Users/jetbrains/Oracle/instantclient_19_8/network/wallet"))) SSL_SERVER_DN_MATCH=yes

    Consider the following screenshot of the admin directory and configuration files.

    Configuring TNS files

Creating the Oracle Cloud connection

Step 1. Prepare a driver for the OCI Cloud connection

  1. In the Database tool window (View | Tool Windows | Database), click the Data Source Properties icon The Data Source Properties icon.

  2. In the Data Sources and Drivers dialog, click the Drivers tab.

  3. In the list of drivers, right-click the Oracle driver and select Duplicate.

  4. Change the name of the duplicated Oracle driver (for example, Oracle [Cloud]).

  5. In the Driver Files pane, click the Add icon (the Add button) and select Custom JARs….

  6. In the file browser, navigate to the directory of the Instant Client that you created previously (for example, ~/Oracle/instantclient_19_8).

  7. In the directory, select the following files: ojdbc8.jar, orai18n.jar, and oraclepki.jar.

  8. Click Open.

  9. In the Driver Files pane, click the Add icon (the Add button) and select Native Library Path….

  10. In the file browser, navigate to the directory of the Instant Client created previously (for example, ~/Oracle/instantclient_19_8) and click Open.

     Preparing drivers for the OCI connection

Step 2. Create the OCI connection

  1. In the Database tool window (View | Tool Windows | Database), click the Data Source Properties icon The Data Source Properties icon.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select Oracle.

  3. From the Connection type list, select TNS.

    Select the Connection type
  4. From the Driver list, select OCI.

    Select the OCI driver
  5. Click the Driver link and select the driver entry that you created on Step 1.

    Click the driver link
  6. In the TNSADMIN field, click the browse button and navigate to the directory with the Instant Client (in our case, ~/Oracle/instantclient_19_8/).

  7. In the TNS name field, specify what service name to use (see a value of an alias in tnsnames.ora).

  8. Specify credentials for the Oracle user.

  9. To ensure that the connection to the data source is successful, click the Test Connection link.

Create the OCI connection
Last modified: 01 August 2022