GBase JDBC Catalog
Doris JDBC Catalog 支持通过标准 JDBC 接口连接 GBase 数据库。本文档介绍如何配置 GBase 数据库连接。
关于 JDBC Catalog 概述,请参阅: JDBC Catalog 概述
GBase JDBC Catalog 自 SelectDB 2.1.12、3.0.9、3.1.6 和 4.0.6 版本开始支持。
使用须知
要连接到 GBase 数据库,您需要
-
提供
jdbc:gbase连接协议的 GBase 数据库实例。 -
与目标 GBase 版本匹配的 JDBC 驱动程序。以下示例使用
gbase-connector-java-9.5.0.7-build1-bin.jar。 -
Doris 每个 FE 和 BE 节点和 GBase 服务器之间的网络连接。以下示例端口为
5258。
连接 GBase
CREATE CATALOG gbase_catalog PROPERTIES (
'type' = 'jdbc',
'user' = 'username',
'password' = 'pwd',
'jdbc_url' = 'jdbc:gbase://host:5258/database',
'driver_url' = 'gbase-connector-java-9.5.0.7-build1-bin.jar',
'driver_class' = 'com.gbase.jdbc.Driver'
);
jdbc_url 定义要传递给 GBase JDBC 驱动程序的连接信息和参数。请根据实际部署填写数据库名以及驱动支持的其他连接参数。
层级映射
映射 GBase 时,Doris 的一个 Database 对应于 GBase 中的一个 Database。而 Doris 的 Database 下的 Table 则对应于 GBase 中,该 Database 下的 Tables。即映射关系如下:
| Doris | GBase |
|---|---|
| Catalog | GBase Server |
| Database | Database |
| Table | Table |
列类型映射
| GBase Type | Doris Type | Comment |
|---|---|---|
| tinyint | tinyint | |
| smallint | smallint | |
| int / integer | int | |
| bigint | bigint | |
| float / real | float | |
| double | double | |
| decimal(P, S) | decimal(P, S) / string | 如果精度超过 Doris DECIMAL 支持范围,则映射为 string。 |
| numeric(P, S) | decimal(P, S) / string | 如果精度超过 Doris DECIMAL 支持范围,则映射为 string。 |
| date | date | |
| datetime / timestamp | datetime(S) | S 最大支持到 6。 |
| char(N) | char(N) | |
| varchar / text / longvarchar | string | |
| time | string | Doris 不支持 time 类型,time 类型会被映射为 string。 |
| other | UNSUPPORTED |
常见问题
-
创建或查询 GBase Catalog 时出现
Failed to load driver class com.gbase.jdbc.Driver请确认创建 Catalog 时填写的
driver_class为com.gbase.jdbc.Driver,并且driver_url指向的 JDBC 驱动 Jar 已经放置到所有 FE 和 BE 节点可访问的位置。 -
查询 GBase Catalog 时希望确认 LIMIT 是否下推
可以通过
EXPLAIN查看生成的 SQL。对于满足条件的查询,Doris 会将LIMIT下推到 GBase。