DataGrip 2021.3 Help

Connect to Oracle by using Kerberos (JDBC Thin Driver)

Prerequisites

This tutorial does not cover the configuration of Windows Server and Oracle instances. Consider reading the official documentation of these vendors.

Client side

Before configuring the connection in DataGrip, ensure that you have configured and got the following prerequisites:

Server side

For more information about configuring the server side, consider reading the following links.

Configuring data source in DataGrip

First, you need to obtain a ticket for a user. To obtain the ticket, you need to run the kinit command with the username.

Run kinit in the command prompt

  1. In the command prompt or in the terminal, run the following command:

    kinit oraclekrb

    Instead of oraclekrb, use your username.

  2. Enter a password for the username.

    kinit in the command prompt

Create a data source

  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 Explorer (View | Tool Windows | Database Explorer), 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 SID.

    Select the Connection type
  4. In the Host field, type the host address of your database.

  5. In the SID field, enter the instance name. You can ask your database administrator for the instance name or try running the following query in the command prompt when connected to the instance with your user:

    SELECT sys_context('userenv','instance_name') FROM dual;
  6. From the Driver list, select Thin.

    Select the Thin driver
  7. From the Authentication list, select Kerberos.

    Kerberos authentication type
  8. On the General tab, click Test Connection to ensure that the connection is successful.

    db_create_a_data_source_kerberos_oracle_thin

Check an authentication method

  • Run the following query from the data editor:

    SELECT sys_context('userenv', 'authentication_method') FROM dual;
    Check a authentication method

Troubleshooting

EncryptionKey: Key bytes cannot be null!

There are cases when the connection does not work with the Oracle driver 21.1.0.0. Try switching to other driver versions (for example, 19.8.0.0 or 12.2.0.1). For more information about changing the driver's version, see Change the driver version.

Last modified: 22 November 2021