diff --git a/docs/content/docs/databases.cn.mdx b/docs/content/docs/databases.cn.mdx index 87226fdc6..d9d78a1a5 100644 --- a/docs/content/docs/databases.cn.mdx +++ b/docs/content/docs/databases.cn.mdx @@ -19,6 +19,8 @@ DBX 通过 Rust 原生驱动支持 25+ 种数据库。 | SQL Server | tiberius | TDS | | Oracle | oracle-rs | OCI | | Elasticsearch | HTTP client | REST | +| DM(达梦) | odbc-api | ODBC | +| GaussDB | odbc-api | ODBC | ## MySQL 兼容 @@ -41,12 +43,83 @@ DBX 通过 Rust 原生驱动支持 25+ 种数据库。 | 数据库 | 默认端口 | 备注 | |---|---|---| -| openGauss | 5432 | | -| GaussDB | 5432 | | +| openGauss | 5432 | SHA256 认证失败时可选 GaussDB(ODBC)连接 | | KingBase(人大金仓) | 54321 | | | Vastbase | 5432 | | | Redshift | 5439 | | | CockroachDB | 26257 | | -| DM(达梦) | 5236 | 需开启 PG 兼容模式 | -**达梦数据库说明:** 达梦数据库需要开启 PG 兼容模式。在 `dm.ini` 中设置 `COMPATIBLE_MODE=7` 并重启服务。 +## ODBC 数据库 + +DM(达梦)和 GaussDB 通过 ODBC 连接,需要在系统上安装对应的 ODBC 驱动。 + +### DM(达梦) + +达梦 DM8 通过 ODBC 驱动连接。默认端口:**5236**,默认用户:**SYSDBA**。 + +**Linux 配置:** + +```bash +# 安装 unixODBC +sudo apt install unixodbc + +# 安装达梦数据库(安装包含 ODBC 驱动) +# 下载地址:https://eco.dameng.com/download/ + +# 在 /etc/odbcinst.ini 中注册驱动 +sudo tee -a /etc/odbcinst.ini << 'EOF' +[DM8 ODBC DRIVER] +Description = DM8 ODBC Driver +Driver = /opt/dmdbms/bin/libdodbc.so +EOF +``` + +**Windows 配置:** + +达梦安装程序会自动注册 ODBC 驱动,无需手动配置。 + +**macOS 配置:** + +达梦暂未提供 macOS 原生 ODBC 驱动。开发/测试建议使用 Linux 环境连接。 + +### GaussDB / openGauss + +GaussDB 通过 ODBC 连接,用于绕过其自有的 SHA256 SASL 认证(标准 PostgreSQL 驱动不支持)。默认端口:**5432**,默认用户:**gaussdb**。 + +> **提示:** 如果你的 openGauss 实例使用 MD5 认证,可以直接选择 PostgreSQL(openGauss)驱动连接,无需 ODBC。 + +**Linux 配置:** + +```bash +# 安装 unixODBC +sudo apt install unixodbc + +# 从华为云下载 GaussDB ODBC 驱动 +# https://support.huaweicloud.com/mgtg-dws/dws_01_0032.html + +# 在 /etc/odbcinst.ini 中注册驱动 +sudo tee -a /etc/odbcinst.ini << 'EOF' +[GaussDBA] +Description = GaussDB ODBC Driver +Driver = /usr/lib/odbc/lib/psqlodbcw.so +EOF +``` + +**macOS 配置(使用 psqlODBC 替代):** + +```bash +# 安装 unixODBC 和 psqlODBC +brew install unixodbc psqlodbc + +# 在 odbcinst.ini 中注册为 GaussDBA +DRIVER_PATH=$(find /opt/homebrew/Cellar/psqlodbc -name "psqlodbcw.so" | head -1) +sudo tee -a /opt/homebrew/etc/odbcinst.ini << EOF +[GaussDBA] +Description = GaussDB ODBC Driver (via psqlODBC) +Driver = $DRIVER_PATH +EOF +``` + +**Windows 配置:** + +从[华为云](https://support.huaweicloud.com/mgtg-dws/dws_01_0032.html)下载并安装 GaussDB ODBC 驱动,安装程序会自动注册。 diff --git a/docs/content/docs/databases.mdx b/docs/content/docs/databases.mdx index dd119a99d..fa38b2d9f 100644 --- a/docs/content/docs/databases.mdx +++ b/docs/content/docs/databases.mdx @@ -21,6 +21,8 @@ DBX supports 25+ database engines through native Rust drivers. | SQL Server | tiberius | TDS | | Oracle | oracle-rs | OCI | | Elasticsearch | HTTP client | REST | +| DM (Dameng) | odbc-api | ODBC | +| GaussDB | odbc-api | ODBC | ## MySQL Compatible @@ -43,13 +45,83 @@ These databases use PostgreSQL protocol and work with the PostgreSQL driver: | Database | Default Port | Notes | |---|---|---| -| openGauss | 5432 | | -| GaussDB | 5432 | | +| openGauss | 5432 | Use GaussDB (ODBC) if SHA256 auth fails | | KingBase | 54321 | | | Vastbase | 5432 | | | Redshift | 5439 | | | CockroachDB | 26257 | | -| DM (Dameng) | 5236 | Requires PG compatibility mode | -> **DM (Dameng) Note:** -> DM database requires PG compatibility mode to be enabled. Set `COMPATIBLE_MODE=7` in `dm.ini` and restart the service. +## ODBC Databases + +DM (Dameng) and GaussDB connect through ODBC, which requires an ODBC driver installed on your system. + +### DM (Dameng) + +DM8 connects via the DM ODBC driver. Default port: **5236**, default user: **SYSDBA**. + +**Linux setup:** + +```bash +# Install unixODBC +sudo apt install unixodbc + +# Install DM8 (includes ODBC driver) +# Download from https://eco.dameng.com/download/ + +# Register the driver in /etc/odbcinst.ini +sudo tee -a /etc/odbcinst.ini << 'EOF' +[DM8 ODBC DRIVER] +Description = DM8 ODBC Driver +Driver = /opt/dmdbms/bin/libdodbc.so +EOF +``` + +**Windows setup:** + +The DM8 installer automatically registers the ODBC driver. No manual configuration needed. + +**macOS setup:** + +DM does not provide a native macOS ODBC driver. For development/testing, DM is best accessed from Linux. + +### GaussDB / openGauss + +GaussDB connects via ODBC to bypass its custom SHA256 SASL authentication (which standard PostgreSQL drivers don't support). Default port: **5432**, default user: **gaussdb**. + +> **Tip:** If your openGauss instance uses MD5 authentication, you can connect directly using the PostgreSQL (openGauss) driver without ODBC. + +**Linux setup:** + +```bash +# Install unixODBC +sudo apt install unixodbc + +# Download GaussDB ODBC driver from Huawei Cloud +# https://support.huaweicloud.com/mgtg-dws/dws_01_0032.html + +# Register the driver in /etc/odbcinst.ini +sudo tee -a /etc/odbcinst.ini << 'EOF' +[GaussDBA] +Description = GaussDB ODBC Driver +Driver = /usr/lib/odbc/lib/psqlodbcw.so +EOF +``` + +**macOS setup (using psqlODBC as a workaround):** + +```bash +# Install unixODBC and psqlODBC +brew install unixodbc psqlodbc + +# Register as GaussDBA in odbcinst.ini +DRIVER_PATH=$(find /opt/homebrew/Cellar/psqlodbc -name "psqlodbcw.so" | head -1) +sudo tee -a /opt/homebrew/etc/odbcinst.ini << EOF +[GaussDBA] +Description = GaussDB ODBC Driver (via psqlODBC) +Driver = $DRIVER_PATH +EOF +``` + +**Windows setup:** + +Download and install the GaussDB ODBC driver from [Huawei Cloud](https://support.huaweicloud.com/mgtg-dws/dws_01_0032.html). The installer registers the driver automatically.