|
| 1 | +# Connecting to {{ ydb-short-name }} with DataGrip |
| 2 | + |
| 3 | +[DataGrip](https://www.jetbrains.com/datagrip/) is a powerful cross-platform tool for relational and NoSQL databases. |
| 4 | + |
| 5 | +DataGrip allows you to work with {{ ydb-short-name }} using the Java Database Connectivity ([JDBC](https://en.wikipedia.org/wiki/Java_Database_Connectivity)) protocol. This article demonstrates how to set up this integration. |
| 6 | + |
| 7 | + |
| 8 | +### Adding the {{ ydb-short-name }} JDBC Driver to DataGrip {#datagrip_ydb} |
| 9 | + |
| 10 | + |
| 11 | +To connect to {{ ydb-name }} from DataGrip, you need the {{ ydb-name }} JDBC driver. |
| 12 | + |
| 13 | +To download the {{ ydb-short-name }} JDBC driver, follow these steps: |
| 14 | + |
| 15 | +1. Go to the [ydb-jdbc-driver repository](https://github.com/ydb-platform/ydb-jdbc-driver/releases). |
| 16 | + |
| 17 | +1. Select the latest release (tagged as `Latest`) and save the `ydb-jdbc-driver-shaded-<driver-version>.jar` file. |
| 18 | + |
| 19 | +To add the downloaded JDBC driver to DataGrip, follow these steps: |
| 20 | + |
| 21 | +1. In DataGrip, go to **File | Data Sources…**. |
| 22 | + |
| 23 | + The **Data Sources and Drivers** dialog box appears. |
| 24 | + |
| 25 | +1. In the **Data Sources and Drivers** dialog box, open the **Drivers** tab and click the **+** button. |
| 26 | + |
| 27 | +1. In the **Name** field, specify `YDB`. |
| 28 | + |
| 29 | + |
| 30 | +1. In the **Driver Files** section, click the **+** button, choose **Custom JARs…**, specify the path to the previously downloaded {{ ydb-short-name }} JDBC driver (the `ydb-jdbc-driver-shaded-<driver-version>.jar` file), and click **OK**: |
| 31 | + |
| 32 | +1. In the **Class** drop-down list, select `tech.ydb.jdbc.YdbDriver`. |
| 33 | + |
| 34 | +  |
| 35 | + |
| 36 | +1. Click **OK**. |
| 37 | + |
| 38 | +### Creating a Connection to {{ ydb-name }} {#datagrip_ydb_connection} |
| 39 | + |
| 40 | +To establish a connection, perform the following steps: |
| 41 | + |
| 42 | +1. In DataGrip, go to **File | Data Sources…**. |
| 43 | + |
| 44 | + The **Data Sources and Drivers** dialog box appears. |
| 45 | + |
| 46 | +1. In the **Data Sources and Drivers** dialog box, on the **Data Sources** tab, click the **+** button and select `YDB`. |
| 47 | + |
| 48 | +1. In the **Authentication** drop-down list, select an authentication method. |
| 49 | + |
| 50 | +1. If you selected the `User & Password` authentication method, in the **User** and **Password** fields, enter your YDB login and password. |
| 51 | + |
| 52 | +1. On the **General** tab, in the **URL** field, specify the following connection string: |
| 53 | + |
| 54 | + ``` |
| 55 | + jdbc:ydb:<ydb_endpoint>/<ydb_database>?useQueryService=true |
| 56 | + ``` |
| 57 | +
|
| 58 | + Where: |
| 59 | + - `ydb_endpoint` — the [endpoint](../../concepts/connect.md#endpoint) of the {{ydb-name}} cluster. |
| 60 | + - `ydb_database` — the path to the [database](../../concepts/glossary.md#database) in the {{ydb-name}} cluster. |
| 61 | +
|
| 62 | + A complete list of authentication methods and connection strings for {{ ydb-name }} is provided in the [JDBC driver](https://github.com/ydb-platform/ydb-jdbc-driver) description. |
| 63 | +
|
| 64 | +  |
| 65 | +
|
| 66 | +1. Click **Test Connection** to verify the settings. |
| 67 | +
|
| 68 | + If all the settings are correct, a message appears indicating a successful connection test. |
| 69 | +
|
| 70 | +1. Click **OK** to save the connection. |
| 71 | +
|
| 72 | +
|
| 73 | +### Working with {{ ydb-name }} {#datagrip_ydb_connection} |
| 74 | +
|
| 75 | +With DataGrip you can view the list and structure of tables. |
| 76 | +
|
| 77 | + |
| 78 | +
|
| 79 | +You can also execute queries on the data. |
| 80 | +
|
| 81 | + |
0 commit comments