This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/seatunnel.git
The following commit(s) were added to refs/heads/dev by this push:
new f08c722acb [Feature][Connector-V2] Support GoldenDB JDBC dialect
(#13287)
f08c722acb is described below
commit f08c722acb4a95d8bf0cca76367d331b08539a0d
Author: Daniel <[email protected]>
AuthorDate: Tue Nov 24 15:51:31 2026 +0000
[Feature][Connector-V2] Support GoldenDB JDBC dialect (#13287)
---
docs/en/connectors/sink/Jdbc.md | 12 +++++
docs/en/connectors/source/Jdbc.md | 12 +++++
docs/zh/connectors/sink/Jdbc.md | 12 +++++
docs/zh/connectors/source/Jdbc.md | 12 +++++
.../dialect/goldendb/GoldenDbDialectFactory.java | 49 +++++++++++++++++
.../internal/dialect/JdbcDialectLoaderTest.java | 16 ++++++
.../connectors/seatunnel/jdbc/JdbcMysqlIT.java | 1 +
...bc_goldendb_mysql_protocol_source_and_sink.conf | 63 ++++++++++++++++++++++
8 files changed, 177 insertions(+)
diff --git a/docs/en/connectors/sink/Jdbc.md b/docs/en/connectors/sink/Jdbc.md
index 508f394c47..2b72fec3c4 100644
--- a/docs/en/connectors/sink/Jdbc.md
+++ b/docs/en/connectors/sink/Jdbc.md
@@ -22,6 +22,18 @@ MySQL `DATETIME` maps to SeaTunnel `TIMESTAMP`
(`LocalDateTime`). The MySQL JDBC
When upgrading from a version affected by
[#13024](https://github.com/apache/seatunnel/issues/13024), remove any manual
hour offset added to compensate for shifted `DATETIME` writes. Previously
stored values are not repaired automatically; compare them with the original
source before correcting or reloading data.
+## GoldenDB
+
+To use the MySQL-compatible JDBC dialect and catalog with a GoldenDB driver,
explicitly set `dialect = "GoldenDB"` along with its matching driver class and
URL, for example:
+
+```hocon
+url = "jdbc:goldendb://goldendb-host:3306/example"
+driver = "com.goldendb.jdbc.Driver"
+dialect = "GoldenDB"
+```
+
+Install a GoldenDB JDBC driver compatible with your database version. Driver
class names and supported URL formats depend on that version. GoldenDB
deployments that expose the MySQL protocol may instead use a compatible MySQL
JDBC driver and `jdbc:mysql://` URL; this selects the existing MySQL dialect.
Existing `jdbc:goldendb:` configurations without an explicit dialect continue
to use the generic dialect. The MySQL catalog requires `username` and
`password` and does not forward the JDBC [...]
+
## Using Dependency
Install the `connector-jdbc` plugin first:
diff --git a/docs/en/connectors/source/Jdbc.md
b/docs/en/connectors/source/Jdbc.md
index d8e78eac2e..78011a95cb 100644
--- a/docs/en/connectors/source/Jdbc.md
+++ b/docs/en/connectors/source/Jdbc.md
@@ -10,6 +10,18 @@ JDBC Source is a bounded source: it reads the rows visible
to the database query
If this is your first JDBC Source job, start with [Choose a read
mode](#choose-a-read-mode) and the [Quick start](#quick-start-postgresql). The
complete option reference follows those sections.
+## GoldenDB
+
+To use the MySQL-compatible JDBC dialect and catalog with a GoldenDB driver,
explicitly set `dialect = "GoldenDB"` along with its matching driver class and
URL, for example:
+
+```hocon
+url = "jdbc:goldendb://goldendb-host:3306/example"
+driver = "com.goldendb.jdbc.Driver"
+dialect = "GoldenDB"
+```
+
+Install a GoldenDB JDBC driver compatible with your database version. Driver
class names and supported URL formats depend on that version. GoldenDB
deployments that expose the MySQL protocol may instead use a compatible MySQL
JDBC driver and `jdbc:mysql://` URL; this selects the existing MySQL dialect.
Existing `jdbc:goldendb:` configurations without an explicit dialect continue
to use the generic dialect. The MySQL catalog requires `username` and
`password` and does not forward the JDBC [...]
+
## Using Dependency
Install the `connector-jdbc` plugin first:
diff --git a/docs/zh/connectors/sink/Jdbc.md b/docs/zh/connectors/sink/Jdbc.md
index 6c6939aa94..301c841eb0 100644
--- a/docs/zh/connectors/sink/Jdbc.md
+++ b/docs/zh/connectors/sink/Jdbc.md
@@ -22,6 +22,18 @@ MySQL `DATETIME` 映射为 SeaTunnel
`TIMESTAMP`(`LocalDateTime`)。MySQL JD
从受 [#13024](https://github.com/apache/seatunnel/issues/13024) 影响的版本升级时,请移除为补偿
`DATETIME` 写入偏移而手动添加的小时偏移。已经写入的数据不会自动修复;修正或重新加载之前,请先与原始数据进行比较。
+## GoldenDB
+
+使用 GoldenDB 驱动以及兼容 MySQL 的 JDBC 方言和 catalog 时,请显式设置 `dialect =
"GoldenDB"`,并配置与驱动匹配的驱动类和 URL,例如:
+
+```hocon
+url = "jdbc:goldendb://goldendb-host:3306/example"
+driver = "com.goldendb.jdbc.Driver"
+dialect = "GoldenDB"
+```
+
+请自行安装与数据库版本兼容的 GoldenDB JDBC 驱动;驱动类名和支持的 URL 格式以实际版本为准。提供 MySQL 协议的 GoldenDB
部署也可以使用兼容的 MySQL JDBC 驱动和 `jdbc:mysql://` URL,此时会选择现有的 MySQL 方言。未显式指定方言的既有
`jdbc:goldendb:` 配置仍使用通用方言。MySQL catalog 要求配置 `username` 和 `password`,且不会将 JDBC
`properties` 映射传给 catalog 连接。生产使用前请针对实际 GoldenDB 版本验证 SQL、数据类型和事务行为;MySQL
测试不能代替 GoldenDB 数据库及驱动的验证。
+
## 使用依赖
先安装 `connector-jdbc` 插件:
diff --git a/docs/zh/connectors/source/Jdbc.md
b/docs/zh/connectors/source/Jdbc.md
index 672f18a037..6194e0f8c4 100644
--- a/docs/zh/connectors/source/Jdbc.md
+++ b/docs/zh/connectors/source/Jdbc.md
@@ -10,6 +10,18 @@ JDBC Source 是有界数据源:它读取数据库查询当前可见的数据
第一次配置 JDBC Source
时,请先阅读[选择读取模式](#选择读取模式)和[快速入门](#快速入门postgresql),再按需查阅后面的完整参数说明。
+## GoldenDB
+
+使用 GoldenDB 驱动以及兼容 MySQL 的 JDBC 方言和 catalog 时,请显式设置 `dialect =
"GoldenDB"`,并配置与驱动匹配的驱动类和 URL,例如:
+
+```hocon
+url = "jdbc:goldendb://goldendb-host:3306/example"
+driver = "com.goldendb.jdbc.Driver"
+dialect = "GoldenDB"
+```
+
+请自行安装与数据库版本兼容的 GoldenDB JDBC 驱动;驱动类名和支持的 URL 格式以实际版本为准。提供 MySQL 协议的 GoldenDB
部署也可以使用兼容的 MySQL JDBC 驱动和 `jdbc:mysql://` URL,此时会选择现有的 MySQL 方言。未显式指定方言的既有
`jdbc:goldendb:` 配置仍使用通用方言。MySQL catalog 要求配置 `username` 和 `password`,且不会将 JDBC
`properties` 映射传给 catalog 连接。生产使用前请针对实际 GoldenDB 版本验证 SQL、数据类型和事务行为;MySQL
测试不能代替 GoldenDB 数据库及驱动的验证。
+
## 使用依赖
先安装 `connector-jdbc` 插件:
diff --git
a/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/goldendb/GoldenDbDialectFactory.java
b/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/goldendb/GoldenDbDialectFactory.java
new file mode 100644
index 0000000000..41d10c4da3
--- /dev/null
+++
b/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/goldendb/GoldenDbDialectFactory.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package
org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.goldendb;
+
+import
org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.JdbcDialect;
+import
org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.JdbcDialectFactory;
+import
org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.mysql.MysqlDialect;
+
+import com.google.auto.service.AutoService;
+
+/** Selects the MySQL-compatible dialect for GoldenDB JDBC connections. */
+@AutoService(JdbcDialectFactory.class)
+public class GoldenDbDialectFactory implements JdbcDialectFactory {
+ @Override
+ public String dialectFactoryName() {
+ return "GoldenDB";
+ }
+
+ @Override
+ public boolean acceptsURL(String url) {
+ // Preserve the generic dialect used by existing GoldenDB URL
configurations.
+ return false;
+ }
+
+ @Override
+ public JdbcDialect create() {
+ return new MysqlDialect();
+ }
+
+ @Override
+ public JdbcDialect create(String compatibleMode, String fieldIde) {
+ return new MysqlDialect(fieldIde);
+ }
+}
diff --git
a/seatunnel-connectors-v2/connector-jdbc/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/JdbcDialectLoaderTest.java
b/seatunnel-connectors-v2/connector-jdbc/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/JdbcDialectLoaderTest.java
index 89a980b4cc..a82bd37814 100644
---
a/seatunnel-connectors-v2/connector-jdbc/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/JdbcDialectLoaderTest.java
+++
b/seatunnel-connectors-v2/connector-jdbc/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/JdbcDialectLoaderTest.java
@@ -51,6 +51,22 @@ public class JdbcDialectLoaderTest {
Assertions.assertInstanceOf(MysqlDialect.class, jdbcDialect);
}
+ @Test
+ void shouldSelectGoldenDbWithoutChangingMysqlSelection() {
+ String goldenDbUrl = "jdbc:goldendb://localhost:3306/test";
+ Assertions.assertEquals(
+ GenericDialect.class, JdbcDialectLoader.load(goldenDbUrl,
null, "").getClass());
+ Assertions.assertEquals(
+ MysqlDialect.class, JdbcDialectLoader.load(goldenDbUrl,
"GoldenDB", "").getClass());
+ Assertions.assertEquals(
+ MysqlDialect.class,
+ JdbcDialectLoader.load("jdbc:mysql://localhost:3306/test",
"GoldenDB", "")
+ .getClass());
+ Assertions.assertEquals(
+ MysqlDialect.class,
+ JdbcDialectLoader.load("jdbc:mysql://localhost:3306/test",
null, "").getClass());
+ }
+
/** Test for {@link JdbcDialectLoader} for appointDialect */
@Test
public void shouldFindPostgresSQLDialectByDialect() throws Exception {
diff --git
a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-part-1/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/JdbcMysqlIT.java
b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-part-1/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/JdbcMysqlIT.java
index 81ae487342..8af11fae79 100644
---
a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-part-1/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/JdbcMysqlIT.java
+++
b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-part-1/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/JdbcMysqlIT.java
@@ -120,6 +120,7 @@ public class JdbcMysqlIT extends AbstractJdbcIT {
private static final List<String> CONFIG_FILE =
Lists.newArrayList(
"/jdbc_mysql_source_and_sink.conf",
+ "/jdbc_goldendb_mysql_protocol_source_and_sink.conf",
"/jdbc_mysql_source_and_sink_parallel.conf",
"/jdbc_mysql_source_and_sink_parallel_upper_lower.conf",
"/jdbc_mysql_source_and_sink.sql",
diff --git
a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-part-1/src/test/resources/jdbc_goldendb_mysql_protocol_source_and_sink.conf
b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-part-1/src/test/resources/jdbc_goldendb_mysql_protocol_source_and_sink.conf
new file mode 100644
index 0000000000..b5e63a6d6b
--- /dev/null
+++
b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-part-1/src/test/resources/jdbc_goldendb_mysql_protocol_source_and_sink.conf
@@ -0,0 +1,63 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+env {
+ parallelism = 1
+ job.mode = "BATCH"
+}
+
+source {
+ jdbc {
+ url = "jdbc:mysql://mysql-e2e:3306/seatunnel"
+ driver = "com.mysql.cj.jdbc.Driver"
+ dialect = "GoldenDB"
+ connection_check_timeout_sec = 100
+ username = "root"
+ password = "Abc!@#135_seatunnel"
+
+ query = "select * from source;"
+ properties {
+ useSSL=false
+ rewriteBatchedStatements=true
+ }
+ }
+}
+
+transform {
+}
+
+sink {
+ jdbc {
+ url = "jdbc:mysql://mysql-e2e:3306/seatunnel"
+ driver = "com.mysql.cj.jdbc.Driver"
+ dialect = "GoldenDB"
+ username = "root"
+ password = "Abc!@#135_seatunnel"
+
+ query = """insert into sink (`c-bit_1`, c_bit_8, c_bit_16, c_bit_32,
c_bit_64, c_tinyint_1, c_tinyint, c_tinyint_unsigned, c_smallint,
c_smallint_unsigned,
+ c_mediumint,
c_mediumint_unsigned, c_int, c_integer, c_bigint, c_bigint_unsigned,
+ c_decimal, c_decimal_unsigned,
c_float, c_float_unsigned, c_double, c_double_unsigned,
+ c_char, c_tinytext,
c_mediumtext, c_text, c_varchar, c_json, c_longtext, c_date,
+ c_datetime, c_time,
c_timestamp, c_tinyblob, c_mediumblob, c_blob, c_longblob, c_varbinary,
+ c_binary, c_year,
c_int_unsigned,
c_integer_unsigned,c_bigint_30,c_decimal_unsigned_30,c_decimal_30)
+ values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?);"""
+ properties {
+ useSSL=false
+ rewriteBatchedStatements=true
+ }
+ }
+}