RubyMine 2023.2 Help

Connect to Oracle Cloud by using wallets

Official documentation and software

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.

Prerequisites

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. Open data source properties. You can open data source properties by using one of the following options:

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

    • Press Control+Alt+Shift+S.

  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. To connect to the database, create a data source that will store your connection details. You can do this using one of the following ways:

    • From the main menu, navigate to File | New | Data Source and select Oracle.

    • In the Database tool window ( View | Tool Windows | Database) , click the New icon (the New icon) in the toolbar. Navigate to Data Source and select Oracle.

    Create a new data source
  2. From the Connection type list, select TNS.

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

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

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

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

  7. Specify credentials for the Oracle user.

  8. Ensure that the connection to the database can be established using the provided details. To do that, click the Test Connection link at the bottom of the connection details area.

    Test Connection link

    In case of any connection issues, refer to the Cannot connect to a database page.

  9. (Optional) By default, only the default schema is introspected and available to work with. If you also want to work with other schemas, in the Schemas tab, select them for the introspection.

    Schemas tab of the Data Sources and Drivers dialog
  10. Click OK to create the data source.

  11. Find your new data source in the Database tool window (Alt+1) .

    • To learn more about the Database tool window, see the corresponding reference topic.

    • To learn how to work with database objects in RubyMine, see Database objects.

    • To write and run queries, open the default query console by clicking the data source and pressing F4.

    • To view data of a database object, open Data Editor and Viewer by double-clicking the object.

Create the OCI connection
Last modified: 07 July 2023