DataGrip 2020.3 Help

Connect to Oracle with OCI

Creating the Oracle OCI connection

Oracle Call Interface (OCI) is a C language interface to Oracle databases for custom or packaged applications. By using OCI, you can connect to Oracle and authenticate your user by using Windows domain authentication.

  1. Open data source properties. You can open data source properties by using one of the following options:

    • Navigate to File | Data Sources.

    • Press Ctrl+Alt+Shift+S.

    • 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. At the bottom of the data source settings area, click the Download missing driver files link.

  4. From the Connection type list, select TNS.

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

    Select the OCI driver
  6. Click the Oracle driver link.

    Click the driver link
  7. In the Driver files pane, select the exiting driver entry and click the Remove button (the Remove button ).

  8. Click the Add button (the Add button) and select Custom JARs. In the file browser, navigate to ojdbc*.jar and orai18n.jar files.

    You can get these files in the following locations:

    • The ORACLE_HOME directory that is a directory where the Oracle software is installed. By default, ojdbc*.jar is in ORACLE_HOME\jdbc\lib. Take the maximum available version of ojdbc*.jar in the directory (for example, ojdbc7.jar ). orai18n.jar is in the ORACLE_HOME\jlib.

    • Download them from the Oracle site. Ensure that you download ojdbc*.jar and orai18n.jar that are suitable for your server version.

  9. In the file browser, select a file and click Open. Add ojdbc*.jar and orai18n.jar to the Driver files pane.

    Add driver files
  10. Click the Add button (the Add button) and select Native Library Path. In the file browser, navigate to the bin directory in the $ORACLE_HOME directory. To find the current value of the $ORACLE_HOME variable, open the command prompt and run echo %ORACLE_HOME% (for Windows) or echo $ORACLE_HOME (for Linux and macOS).

    Use this action instead of setting LD_LIBRARY_PATH (macOS and Linux) or PATH (Windows) environment variables to $ORACLE_HOME\BIN.

  11. Click the created Oracle data source.

  12. In the TNSADMIN field, specify the path to the tnsnames.ora. By default, tnsnames.ora is located in the ORACLE_HOME/network/admin directory. For more information about tnsnames.ora, see Local Naming Parameters (tnsnames.ora) at docs.oracle.com.

  13. In the TNS name field, specify what service name to use (see a value of net_service_name in tnsnames.ora) if you have more than one service.

    Set the TNS name
  14. To ensure that the connection to the data source is successful, click Test Connection.

Connecting to Oracle by using Windows domain authentication

  1. Create an OCI connection to Oracle. For more information about creating the OCI connection, see Creating the Oracle OCI connection.

  2. Right-click the Password field and select Set empty.

  3. From the Save list, select Forever.

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

Set the empty password
Last modified: 15 April 2021