跳到主要内容
版本:2.1

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。即映射关系如下:

DorisGBase
CatalogGBase Server
DatabaseDatabase
TableTable

列类型映射

GBase TypeDoris TypeComment
tinyinttinyint
smallintsmallint
int / integerint
bigintbigint
float / realfloat
doubledouble
decimal(P, S)decimal(P, S) / string如果精度超过 Doris DECIMAL 支持范围,则映射为 string。
numeric(P, S)decimal(P, S) / string如果精度超过 Doris DECIMAL 支持范围,则映射为 string。
datedate
datetime / timestampdatetime(S)S 最大支持到 6。
char(N)char(N)
varchar / text / longvarcharstring
timestringDoris 不支持 time 类型,time 类型会被映射为 string。
otherUNSUPPORTED

常见问题

  1. 创建或查询 GBase Catalog 时出现 Failed to load driver class com.gbase.jdbc.Driver

    请确认创建 Catalog 时填写的 driver_classcom.gbase.jdbc.Driver,并且 driver_url 指向的 JDBC 驱动 Jar 已经放置到所有 FE 和 BE 节点可访问的位置。

  2. 查询 GBase Catalog 时希望确认 LIMIT 是否下推

    可以通过 EXPLAIN 查看生成的 SQL。对于满足条件的查询,Doris 会将 LIMIT 下推到 GBase。