# Connect to Managed ClickHouse® with the JDBC driver

You can use the [ClickHouse JDBC
driver](https://github.com/ClickHouse/clickhouse-java/tree/main/clickhouse-jdbc)
to connect a JDBC client, an application or a BI tool to your Managed ClickHouse database
over HTTPS.

You will need Managed ClickHouse® service, accessible by HTTPS. Read the HTTPS host and port
from the `clickhouse_https` entry of the service components:

```bash
exo x get-dbaas-service-clickhouse my-clickhouse -z ch-gva-2 \
  -q "components[?component=='clickhouse_https']"
```

> [!NOTE]
> To reach an *external* database *from* your service instead, see
> [Run federated queries in Managed ClickHouse®](/product/dbaas/service-specific/clickhouse/how-to/run-federated-queries/).

 | Variable                | Description                                    |
 | ----------------------- | ---------------------------------------------- |
 | `CLICKHOUSE_HTTPS_HOST` | HTTPS service host of your ClickHouse service. |
 | `CLICKHOUSE_HTTPS_PORT` | HTTPS service port of your ClickHouse service. |
 | `CLICKHOUSE_USER`       | Username to access ClickHouse service.         |
 | `CLICKHOUSE_PASSWORD`   | Password to access ClickHouse service.         |

## Connection string

Replace `CLICKHOUSE_HTTPS_HOST` and `CLICKHOUSE_HTTPS_PORT` with your
connection values:

```
jdbc:ch://CLICKHOUSE_HTTPS_HOST:CLICKHOUSE_HTTPS_PORT?ssl=true&sslmode=STRICT
```

You'll also need to provide user name and password to establish the
connection. For example, if you use Java:

```
Connection connection = dataSource.getConnection("CLICKHOUSE_USER", "CLICKHOUSE_PASSWORD");
```

