DataGrip 2019.2 Help

Connect to a database

To issue a query to a database, you must connect to a data source. The data source is a location of your data (it can be a server, CSV, or a DDL file). The data source connection includes a name and connection settings that are dependent on the data source type. In DataGrip, you can manage these connections in the Data Sources and Drivers dialog (File | Data Sources).

Amazon Redshift

  1. In your Redshift dashboard, create a Redshift cluster.

  2. In settings of the Redshift cluster, copy the JDBC URL.

  3. Navigate to File | Data Sources Ctrl+Alt+S.

  4. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select Amazon Redshift.

  5. At the bottom of the data source settings area, click the Download missing driver files link. Alternatively, you can specify user drivers for the data source. For more information about user drivers, see Add a user driver to an existing connection.

  6. From the Connection type list, select URL only.

  7. Paste the JDBC URL from the Redshift cluster settings to the URL field in DataGrip.

  8. In User and Password fields, specify your Redshift credentials.

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

Integration with Amazon Redshift

Apache Derby

  1. Navigate to File | Data Sources Ctrl+Alt+S.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select Apache Derby.

  3. From the Driver list, select the type of the JDBC driver that you want to use. For remote connections, select Apache Derby (Remote). For embedded databases, select Apache Derby (Embedded).

  4. At the bottom of the data source settings area, click the Download missing driver files link. Alternatively, you can specify user drivers for the data source. For more information about user drivers, see Add a user driver to an existing connection.

  5. Specify database connection details. Alternatively, paste the JDBC URL in the URL field.

    To set an empty password, right-click the Password field and select Set empty.

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

Integration with Apache Derby

Apache Cassandra

  1. Navigate to File | Data Sources Ctrl+Alt+S.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select Apache Cassandra.

  3. At the bottom of the data source settings area, click the Download missing driver files link. Alternatively, you can specify user drivers for the data source. For more information about user drivers, see Add a user driver to an existing connection.

  4. Specify database connection details. Alternatively, paste the JDBC URL in the URL field.

    To set an empty password, right-click the Password field and select Set empty.

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

Integration with Apache Cassandra

Apache Hive

  1. Navigate to File | Data Sources Ctrl+Alt+S.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select Apache Hive.

  3. At the bottom of the data source settings area, click the Download missing driver files link. Alternatively, you can specify user drivers for the data source. For more information about user drivers, see Add a user driver to an existing connection.

  4. Specify database connection details. Alternatively, paste the JDBC URL in the URL field.

    To set an empty password, right-click the Password field and select Set empty.

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

Integration with Apache Hive

Azure SQL Database

  1. In your Microsoft Azure account, create an SQL data source.

  2. In DataGrip, navigate to File | Data Sources N/A.

  3. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select Azure SQL Database.

  4. At the bottom of the data source settings area, click the Download missing driver files link.

  5. Specify database connection details. Alternatively, paste the JDBC URL in the URL field.

    To set an empty password, right-click the Password field and select Set empty.

    To use Azure Active Directory Authentication, select Use Windows domain authentication. To use SQL Authentication, clear the checkbox, and specify your Microsoft Azure credentials in User and Password fields.

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

Integration with Azure SQL Database

ClickHouse

  1. Navigate to File | Data Sources Ctrl+Alt+S.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select ClickHouse.

  3. At the bottom of the data source settings area, click the Download missing driver files link. Alternatively, you can specify user drivers for the data source. For more information about user drivers, see Add a user driver to an existing connection.

  4. Specify database connection details. Alternatively, paste the JDBC URL in the URL field.

    To set an empty password, right-click the Password field and select Set empty.

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

Integration with ClickHouse

DDL data source

SQL files that contain data definition language statements (DDL statements) can be used as data sources. As a result, you can reference all tables, columns and other objects defined in such files in the editor.

  1. Navigate to File | Data Sources Ctrl+Alt+S.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select DDL Data Source.

  3. In the DDL Files pane, click the Add button the Add button.

  4. In the file browser, navigate to the SQL file or files with DDL statements and click Open.

  5. Click Apply.

  6. In the SQL Dialects dialog, select a dialect that you want to use for the added SQL file.

  7. Apply settings and click OK.

Create a DDL data source

Exasol

  1. Navigate to File | Data Sources Ctrl+Alt+S.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select Exasol.

  3. At the bottom of the data source settings area, click the Download missing driver files link. Alternatively, you can specify user drivers for the data source. For more information about user drivers, see Add a user driver to an existing connection.

  4. Specify database connection details. Alternatively, paste the JDBC URL in the URL field.

    To set an empty password, right-click the Password field and select Set empty.

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

Integration with Exasol

Greenplum

  1. Navigate to File | Data Sources Ctrl+Alt+S.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select Greenplum.

  3. At the bottom of the data source settings area, click the Download missing driver files link. Alternatively, you can specify user drivers for the data source. For more information about user drivers, see Add a user driver to an existing connection.

  4. Specify database connection details. Alternatively, paste the JDBC URL in the URL field.

    To set an empty password, right-click the Password field and select Set empty.

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

Integration with Greenplum

H2

  1. Navigate to File | Data Sources Ctrl+Alt+S.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select H2.

  3. At the bottom of the data source settings area, click the Download missing driver files link. Alternatively, you can specify user drivers for the data source. For more information about user drivers, see Add a user driver to an existing connection.

  4. Specify database connection details. Alternatively, paste the JDBC URL in the URL field.

    To set an empty password, right-click the Password field and select Set empty.

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

Integration with H2

HSQLDB

  1. Navigate to File | Data Sources Ctrl+Alt+S.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select HSQLDB.

  3. At the bottom of the data source settings area, click the Download missing driver files link. Alternatively, you can specify user drivers for the data source. For more information about user drivers, see Add a user driver to an existing connection.

  4. Specify database connection details. Alternatively, paste the JDBC URL in the URL field.

    To set an empty password, right-click the Password field and select Set empty.

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

Integration with HSQLDB

IBM Db2

  1. Navigate to File | Data Sources Ctrl+Alt+S.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select IBM Db2.

  3. At the bottom of the data source settings area, click the Download missing driver files link. Alternatively, you can specify user drivers for the data source. For more information about user drivers, see Add a user driver to an existing connection.

  4. Specify database connection details. Alternatively, paste the JDBC URL in the URL field.

    To set an empty password, right-click the Password field and select Set empty.

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

Integration with IBM Db2

MariaDB

  1. Navigate to File | Data Sources Ctrl+Alt+S.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select MariaDB.

  3. At the bottom of the data source settings area, click the Download missing driver files link. Alternatively, you can specify user drivers for the data source. For more information about user drivers, see Add a user driver to an existing connection.

  4. Specify database connection details. Alternatively, paste the JDBC URL in the URL field.

    To set an empty password, right-click the Password field and select Set empty.

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

Integration with MariaDB

Microsoft SQL Server

  1. Navigate to File | Data Sources Ctrl+Alt+S.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select Microsoft SQL Server.

  3. At the bottom of the data source settings area, click the Download missing driver files link. Alternatively, you can specify user drivers for the data source. For more information about user drivers, see Add a user driver to an existing connection.

  4. Specify database connection details. Alternatively, paste the JDBC URL in the URL field.

    To set an empty password, right-click the Password field and select Set empty.

    The Instance field is optional.

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

Integration with Microsoft SQL Server

MySQL

  1. Navigate to File | Data Sources Ctrl+Alt+S.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select MySQL.

  3. At the bottom of the data source settings area, click the Download missing driver files link. Alternatively, you can specify user drivers for the data source. For more information about user drivers, see Add a user driver to an existing connection.

  4. Specify database connection details. Alternatively, paste the JDBC URL in the URL field.

    To set an empty password, right-click the Password field and select Set empty.

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

Integration with MySQL

Oracle

  1. Navigate to File | Data Sources Ctrl+Alt+S.

  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 a connection type:

    • SID: to use a unique name of an Oracle instance (a process that runs on the workstation).

    • Service name: to use an alias to an Oracle instance (or many instances).

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

    • URL only: to use the JDBC URL.

  5. Specify database connection details. Alternatively, paste the JDBC URL in the URL field.

    To set an empty password, right-click the Password field and select Set empty.

  6. From the Driver list, specify the driver type. For more information about driver types, see Oracle JDBC FAQ.

  7. At the bottom of the data source settings area, click the Download missing driver files link. Alternatively, you can specify user drivers for the data source. For more information about user drivers, see Add a user driver to an existing connection.

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

Integration with Oracle

PostgreSQL

  1. Navigate to File | Data Sources Ctrl+Alt+S.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select PostgreSQL.

  3. At the bottom of the data source settings area, click the Download missing driver files link. Alternatively, you can specify user drivers for the data source. For more information about user drivers, see Add a user driver to an existing connection.

  4. Specify database connection details. Alternatively, paste the JDBC URL in the URL field.

    To set an empty password, right-click the Password field and select Set empty.

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

Integration with PostgreSQL

Snowflake

  1. Navigate to File | Data Sources Ctrl+Alt+S.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select Snowflake.

  3. At the bottom of the data source settings area, click the Download missing driver files link. Alternatively, you can specify user drivers for the data source. For more information about user drivers, see Add a user driver to an existing connection.

  4. Specify database connection details. Alternatively, paste the JDBC URL in the URL field.

    To set an empty password, right-click the Password field and select Set empty.

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

Integration with Snowflake

SQLite

  1. Navigate to File | Data Sources Ctrl+Alt+S.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select SQLite.

  3. At the bottom of the data source settings area, click the Download missing driver files link. Alternatively, you can specify user drivers for the data source. For more information about user drivers, see Add a user driver to an existing connection.

  4. To connect to an existing SQLite database, specify a file path to the database file in the File field.

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

Integration with SQLite

Sybase ASE

  1. Navigate to File | Data Sources Ctrl+Alt+S.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select Sybase ASE.

  3. At the bottom of the data source settings area, click the Download missing driver files link. Alternatively, you can specify user drivers for the data source. For more information about user drivers, see Add a user driver to an existing connection.

  4. Specify database connection details. Alternatively, paste the JDBC URL in the URL field.

    To set an empty password, right-click the Password field and select Set empty.

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

Integration with Sybase ASE

Vertica

  1. Navigate to File | Data Sources Ctrl+Alt+S.

  2. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select Vertica.

  3. At the bottom of the data source settings area, click the Download missing driver files link. Alternatively, you can specify user drivers for the data source. For more information about user drivers, see Add a user driver to an existing connection.

  4. Specify database connection details. Alternatively, paste the JDBC URL in the URL field.

    To set an empty password, right-click the Password field and select Set empty.

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

Integration with Vertica
Last modified: 11 November 2019