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

> DBeaver 是一款跨平台数据库工具。

# 将 DBeaver 连接到 ClickHouse

export const PartnerBadge = () => {
  return <div className="PartnerBadge">
            <div className="PartnerBadgeIcon">
                <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <polyline points="12.5 9.5 10 12 6 11 2.5 8.5" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1" />
                    <polyline points="4.54 4.41 8 3.5 11.46 4.41" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1" />
                    <path d="M2.15,3.78 L0.55,6.95 A0.5,0.5 0,0,0 0.77,7.62 L2.5,8.5 L4.54,4.41 L2.82,3.55 A0.5,0.5 0,0,0 2.15,3.78 Z" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1" />
                    <path d="M13.5,8.5 L15.23,7.62 A0.5,0.5 0,0,0 15.45,6.95 L13.85,3.78 A0.5,0.5 0,0,0 13.18,3.55 L11.46,4.41 Z" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1" />
                    <path d="M11.5,4.5 L9,4.5 L6.15,7.27 A0.5,0.5 0,0,0 6.24,8.05 C7.33,8.74 8.81,8.72 10,7.5 L12.5,9.5 L13.5,8.5" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1" />
                    <polyline points="7.75 13.5 5.15 12.85 3.5 11.67" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1" />
                </svg>
            </div>
            合作伙伴集成
        </div>;
};

export const Image = ({img, alt, size = "lg"}) => {
  const normalizedSize = ["sm", "md", "lg"].includes(size) ? size : "lg";
  return <div className={`ch-image-${normalizedSize}`}>
      <Frame>
        <img src={img} alt={alt} />
      </Frame>
    </div>;
};

<PartnerBadge />

DBeaver 提供多个版本。本指南使用的是 [DBeaver Community](https://dbeaver.io/)。请在[此处](https://dbeaver.com/edition/)查看不同版本及其能力。DBeaver 使用 JDBC 连接到 ClickHouse。

<Note>
  为了更好地支持 ClickHouse 中的 `Nullable` 列，请使用 DBeaver 23.1.0 或更高版本。
</Note>

<Steps>
  <Step title="收集你的 ClickHouse 详细信息" id="1-gather-your-clickhouse-details">
    DBeaver 使用基于 HTTP(S) 的 JDBC 连接到 ClickHouse；你需要：

    * 端点
    * 端口号
    * 用户名
    * 密码
  </Step>

  <Step title="下载 DBeaver" id="2-download-dbeaver">
    DBeaver 可从 [https://dbeaver.io/download/](https://dbeaver.io/download/) 下载
  </Step>

  <Step title="添加数据库" id="3-add-a-database">
    * 通过 **Database > New Database Connection** 菜单，或点击 **Database Navigator** 中的 **New Database Connection** 图标，打开 **Connect to a database** 对话框：

    <Image img="https://mintcdn.com/private-7c7dfe99/B2SPNiDHMxYV1gTC/images/integrations/sql-clients/dbeaver-add-database.webp?fit=max&auto=format&n=B2SPNiDHMxYV1gTC&q=85&s=6f6924264c39c27a3c16661592163227" size="md" border alt="添加新数据库" width="642" height="385" data-path="images/integrations/sql-clients/dbeaver-add-database.webp" />

    * 选择 **Analytical**，然后选择 **ClickHouse**：

    * 构建 JDBC URL。在 **Main** 选项卡中设置 Host、Port、Username、Password 和 Database：

    <Image img="https://mintcdn.com/private-7c7dfe99/B2SPNiDHMxYV1gTC/images/integrations/sql-clients/dbeaver-host-port.webp?fit=max&auto=format&n=B2SPNiDHMxYV1gTC&q=85&s=16ee7f52fde1d693090244aadb65fe95" size="md" border alt="设置主机名、端口、用户名、密码和数据库名称" width="650" height="654" data-path="images/integrations/sql-clients/dbeaver-host-port.webp" />

    * 默认情况下，**SSL > Use SSL** 属性未启用；如果要连接到 ClickHouse Cloud 或在 HTTP 端口上要求使用 SSL 的 server，请启用 **SSL > Use SSL**：

    <Image img="https://mintcdn.com/private-7c7dfe99/B2SPNiDHMxYV1gTC/images/integrations/sql-clients/dbeaver-use-ssl.webp?fit=max&auto=format&n=B2SPNiDHMxYV1gTC&q=85&s=c2433e71b3b75b2e2970648c98ddf875" size="md" border alt="根据需要启用 SSL" width="650" height="654" data-path="images/integrations/sql-clients/dbeaver-use-ssl.webp" />

    * 测试连接：

    <Image img="https://mintcdn.com/private-7c7dfe99/B2SPNiDHMxYV1gTC/images/integrations/sql-clients/dbeaver-test-connection.webp?fit=max&auto=format&n=B2SPNiDHMxYV1gTC&q=85&s=bc1487c11c2a6f8abbb8b8623a407039" size="md" border alt="测试连接" width="650" height="654" data-path="images/integrations/sql-clients/dbeaver-test-connection.webp" />

    如果 DBeaver 检测到尚未安装 ClickHouse driver，它会提示你下载：

    <Image img="https://mintcdn.com/private-7c7dfe99/B2SPNiDHMxYV1gTC/images/integrations/sql-clients/dbeaver-download-driver.webp?fit=max&auto=format&n=B2SPNiDHMxYV1gTC&q=85&s=d80540e5b6230d2374e3d90c6e645be7" size="md" border alt="下载 ClickHouse driver" width="612" height="689" data-path="images/integrations/sql-clients/dbeaver-download-driver.webp" />

    * 下载 driver 后，再次 **Test** 连接：

    <Image img="https://mintcdn.com/private-7c7dfe99/B2SPNiDHMxYV1gTC/images/integrations/sql-clients/dbeaver-test-connection.webp?fit=max&auto=format&n=B2SPNiDHMxYV1gTC&q=85&s=bc1487c11c2a6f8abbb8b8623a407039" size="md" border alt="测试连接" width="650" height="654" data-path="images/integrations/sql-clients/dbeaver-test-connection.webp" />
  </Step>

  <Step title="查询 ClickHouse" id="4-query-clickhouse">
    打开查询编辑器并运行查询。

    * 右键点击你的连接，选择 **SQL Editor > Open SQL Script** 以打开查询编辑器：

    <Image img="https://mintcdn.com/private-7c7dfe99/B2SPNiDHMxYV1gTC/images/integrations/sql-clients/dbeaver-sql-editor.webp?fit=max&auto=format&n=B2SPNiDHMxYV1gTC&q=85&s=f103364c2cf38dc970ec95f09bb1c948" size="md" border alt="打开 SQL 编辑器" width="636" height="162" data-path="images/integrations/sql-clients/dbeaver-sql-editor.webp" />

    * 针对 `system.query_log` 的示例查询：

    <Image img="https://mintcdn.com/private-7c7dfe99/B2SPNiDHMxYV1gTC/images/integrations/sql-clients/dbeaver-query-log-select.webp?fit=max&auto=format&n=B2SPNiDHMxYV1gTC&q=85&s=433e0a24f7bf554e8aea6b8a62a67e50" size="md" border alt="示例查询" width="712" height="316" data-path="images/integrations/sql-clients/dbeaver-query-log-select.webp" />
  </Step>
</Steps>

<div id="next-steps">
  ## 后续步骤
</div>

请参阅 [DBeaver wiki](https://github.com/dbeaver/dbeaver/wiki) 了解 DBeaver 的功能，并参阅 [ClickHouse 文档](/docs/zh/) 了解 ClickHouse 的功能。
