> For the complete documentation index, see [llms.txt](https://docs.koinju.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.koinju.io/connect-your-tools/dbeaver-datagrip-vscode.md).

# DBeaver / DataGrip / VS Code

Connect the Koinju ClickHouse database from a desktop SQL IDE — DBeaver, JetBrains DataGrip, or VS Code — and run your first query.

## Before you start

| Setting       | Value                     |
| ------------- | ------------------------- |
| Host          | the provided database URL |
| Port          | 8443                      |
| Protocol      | HTTPS / SSL enabled       |
| Database      | api                       |
| User/Password | provided by Koinju        |

Don't have credentials yet? See [How to connect](/how-to-connect.md).

Port `8443` is the ClickHouse **HTTPS interface** and is what every HTTP/JDBC-based driver below uses. `9440` is the alternative native-protocol-over-TLS port (used only by the native CLI client).

## Step-by-step

### DBeaver

1. **Database ▸ New Database Connection**.
2. Pick **ClickHouse** from the list, click **Next**.
3. On the **Main** tab set:
   * **Host**: the provided database URL
   * **Port**: `8443`
   * **Database/Schema**: `api`
   * **Username** / **Password**: provided by Koinju
4. Open the **SSL** tab and tick **Use SSL**.
5. Click **Test Connection** (DBeaver will offer to download the ClickHouse driver the first time — accept).
6. **Finish**.

### JetBrains DataGrip

1. **File ▸ New ▸ Data Source ▸ ClickHouse**. DataGrip auto-downloads the JDBC driver on first use.
2. Set the connection either by fields (Host = provided database URL, Port = `8443`, Database = `api`) or by pasting the URL directly:

   ```
   jdbc:clickhouse://<host>:8443/api?ssl=true
   ```
3. Enter the **User** and **Password** provided by Koinju.
4. Click **Test Connection**, then **OK**.

### VS Code

1. Install the [**SQLTools**](https://marketplace.visualstudio.com/items?itemName=mtxr.sqltools) extension and the [**SQLTools ClickHouse Driver**](https://marketplace.visualstudio.com/items?itemName=ultram4rine.sqltools-clickhouse-driver) from the VS Code Marketplace.
2. Add a new connection with:
   * **Host**: the provided database URL
   * **Port**: `8443`
   * **SSL**: `true`
   * **Database**: `api`
   * **User** / **Password**: provided by Koinju
3. Connect and open a new SQL editor against the connection.

## First sanity query

Run this in the IDE's SQL editor:

```sql
SELECT exchange, market, timestamp, price
FROM api.trade
WHERE market LIKE 'BTC%' AND timestamp > toStartOfDay(now())
ORDER BY timestamp DESC LIMIT 20
```

If you get \~20 rows back, you're connected. Next, explore what data is available in [Data](/data/coverage.md).
