Connect to Oracle Cloud by using Wallet and OCI
Official documentation and software
For full information about Oracle, refer to the official documentation.
To download Oracle database software, refer to the official software downloads.
For more versions of Oracle JDBC driver, refer to the official JDBC driver downloads.
Download the following Oracle Instant Client (OCI) packages for your operating system from the Oracle Instant Client Downloads page at oracle.com:
Basic Package
SQL*Plus Package
JDBC Supplement Package
DataGrip uses JDBC drivers to connect to the Oracle server through the TNS protocol. The following driver modes are available:
In Thin mode, the JDBC driver always connects to the TNS listener. In this mode, various versions of the JDBC driver can be used.
In OCI mode, the JDBC driver uses native libraries. In this case, the JDBC driver's version must be the same as the version of these native libraries.
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, refer to Creating and Managing Oracle Wallet and Download Client Credentials (Wallets) at docs.oracle.com.
Requirements
Running Oracle Cloud instance with access permissions for your user.
Oracle Wallet.
Creating the Oracle Cloud data source
Step 1. Prepare a driver for the OCI connection
Open data source properties. You can open data source properties by using one of the following options:
Navigate to
.Press Command ;.
In the Database Explorer Command 1 ( ), click the Data Source Properties icon (
).
In the Data Sources and Drivers dialog, click the Drivers tab.
In the list of drivers, right-click the Oracle driver and select Duplicate.
Change the name of the duplicated Oracle driver (for example,
Oracle [Cloud, OCI]
).In the Driver Files pane, click the Add icon (
) and select Native Library Path….
In the file browser, navigate to the directory of the Instant Client files (for example, ~/Oracle/instantclient_19_8) and click Open.
You can use the DataGrip provided driver or the ones provided with Instant Client.
Change the file version so that it is the same with the Instant Client version.
In the Driver Files pane, click the Add icon (
) and select Custom JARs….
In the file browser, navigate to the directory with the Instant Client files (for example, ~/Oracle/instantclient_19_8).
In the directory, select the following files: ojdbc8.jar, orai18n.jar, and oraclepki.jar.
Click Open.
Step 2. Create the Oracle Cloud data source
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 Oracle.
and selectIn the Database Explorer ( ) , click the New icon (
) in the toolbar. Navigate to Data Source and select Oracle.
From the Connection type list, select TNS.
From the Driver list, select OCI.
Click the Driver link and select the driver entry that you created on Step 1 (in our case, Oracle [Cloud, OCI]).
In the TNSADMIN field, click the browse button and navigate to the directory with the Instant Client files (in our case, ~/Oracle/instantclient_19_8/network/admin).
In the TNS name field, use the automatic completion (Control+Space) to select which service name to use (see a value of an alias in the tnsnames.ora file).
Specify credentials for the Oracle user.
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.
In case of any connection issues, refer to the Cannot connect to a database page.
(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.
Click OK to create the data source.
Find your new data source in Database Explorer (Command 1) .
For more information about Database Explorer, see the corresponding reference topic.
For more information about working with database objects in DataGrip, refer to 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 Oracle Cloud data source Create the Oracle Cloud data source](https://resources.jetbrains.com/help/img/idea/2023.2/db_create_the_oracle_cloud_wallet_connection.png)