> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 将 Retool 连接到 ClickHouse

> 借助你的数据，快速构建具有丰富用户界面的 Web 和移动应用，自动化复杂任务，并集成 AI。

合作伙伴集成

**1. 收集连接详细信息**

要通过 HTTP(S) 连接到 ClickHouse，你需要以下信息：

| Parameter(s) | Description |
| - | - |
| `HOST` and `PORT` | 通常，使用 TLS 时端口为 8443；不使用 TLS 时端口为 8123。 |
| `DATABASE NAME` | 默认情况下，存在一个名为 `default` 的数据库。请使用你要连接的数据库名称。 |
| `USERNAME` and `PASSWORD` | 默认情况下，用户名为 `default`。请根据你的使用场景使用相应的用户名。 |

你的 ClickHouse Cloud 服务的连接信息可在 ClickHouse Cloud 控制台中查看。
选择一个服务，然后点击 **Connect**：

![ClickHouse Cloud 服务连接按钮](https://mintcdn.com/private-7c7dfe99/EDr8ydtGBgFPOQea/images/_snippets/cloud-connect-button.webp?fit=max\&auto=format\&n=EDr8ydtGBgFPOQea\&q=85\&s=97d6a020a443f1b365b017488b39d0c8)

选择 **HTTPS**。连接信息会显示在示例 `curl` 命令中。

![ClickHouse Cloud HTTPS 连接信息](https://mintcdn.com/private-7c7dfe99/EDr8ydtGBgFPOQea/images/_snippets/connection-details-https.webp?fit=max\&auto=format\&n=EDr8ydtGBgFPOQea\&q=85\&s=80369fc90cd1ac3108fe455f2426c19a)

如果你使用的是自管理 ClickHouse，则连接信息由你的 ClickHouse 管理员配置。

**2. 创建 ClickHouse 资源**

登录到你的 Retool 账户，然后进入 *Resources* 选项卡。选择 "Create New" -> "Resource"：

![创建新资源](https://mintcdn.com/private-7c7dfe99/6s0zAeps_NYZmK2e/images/integrations/tools/data-integration/retool/retool_01.webp?fit=max\&auto=format\&n=6s0zAeps_NYZmK2e\&q=85\&s=ed34ddfe4447cad699a936e3a36c93c0)

在可用连接器列表中选择 "JDBC"：

![选择 JDBC 连接器](https://mintcdn.com/private-7c7dfe99/6s0zAeps_NYZmK2e/images/integrations/tools/data-integration/retool/retool_02.webp?fit=max\&auto=format\&n=6s0zAeps_NYZmK2e\&q=85\&s=6097acbba8929453d7331456edcea140)

在设置向导中，确保选择 `com.clickhouse.jdbc.ClickHouseDriver` 作为 "Driver name"：

![选择正确的驱动程序](https://mintcdn.com/private-7c7dfe99/6s0zAeps_NYZmK2e/images/integrations/tools/data-integration/retool/retool_03.webp?fit=max\&auto=format\&n=6s0zAeps_NYZmK2e\&q=85\&s=2337f7bac3d54563a89056b2178c268c)

按以下格式填写你的 ClickHouse 凭据：`jdbc:clickhouse://HOST:PORT/DATABASE?user=USERNAME&password=PASSWORD`。
如果你的实例需要 SSL，或者你使用的是 ClickHouse Cloud，请在 connection string 中添加 `&ssl=true`，使其如下所示：`jdbc:clickhouse://HOST:PORT/DATABASE?user=USERNAME&password=PASSWORD&ssl=true`

![填写你的凭据](https://mintcdn.com/private-7c7dfe99/6s0zAeps_NYZmK2e/images/integrations/tools/data-integration/retool/retool_04.webp?fit=max\&auto=format\&n=6s0zAeps_NYZmK2e\&q=85\&s=152fd831d32a0c47bbaf8a2432cb4e54)

之后，测试你的连接：

![测试你的连接](https://mintcdn.com/private-7c7dfe99/6s0zAeps_NYZmK2e/images/integrations/tools/data-integration/retool/retool_05.webp?fit=max\&auto=format\&n=6s0zAeps_NYZmK2e\&q=85\&s=7be77a552d567b407c135fd4ee869dcf)

现在，你应该可以在应用中使用你的 ClickHouse 资源了。
