# 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).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.koinju.io/connect-your-tools/dbeaver-datagrip-vscode.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
