DataGrip 2025.1 Help

Create an Oracle data source using Kerberos and Thin driver

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.

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, refer to the following links.

Configuring data source in DataGrip

Before establishing connection to a Oracle database with Kerberos authentication, make sure you have the authentication ticket by running Kerberos commands in the command prompt or in the terminal.

  • If there is a ticket cache file on your machine and useTicketCache is set to true, run klist command. Make sure it lists your ticket among the cached ones.

  • If ticket cache is not enabled on your machine, do the following:

    1. Run klist command and make sure it lists your ticket.

    2. If your authentication ticket is not on the list, run the kinitcommand with your username to obtain the ticket from server: kinit oraclekrb. Instead of oraclekrb, use your username. When prompted, enter your password.

      kinit in the command prompt

For more information about Kerberos tickets, refer to the Kerberos website.

    Create a data source

    To connect to a database, create a data source that will store your connection details.

    1. Select the data source you want to create. You can do this using one of the following ways:

      • In the main menu, go to File | New | Data Source and select Oracle.

      • In the Database Explorer (⌘ 1) , click the New icon New on the toolbar. Navigate to Data Source and select Oracle.

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

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

    4. 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;
    5. From the Driver list, select Thin.

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

      Kerberos authentication type
    7. 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 an 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, refer to Change the driver version.

    Last modified: 11 April 2025