增加GoldenDB识别(pr#3886@Github)

This commit is contained in:
Looly 2025-03-07 10:56:46 +08:00
parent 58c193cb48
commit 161cb6fc19
4 changed files with 11 additions and 1 deletions

View File

@ -86,6 +86,9 @@ public class DialectFactory {
return new PhoenixDialect(dbConfig);
} else if (DriverNames.DRIVER_DM.equalsIgnoreCase(driverName)) {
return new DmDialect(dbConfig);
} else if (DriverNames.DRIVER_GOLDENDB.equalsIgnoreCase(driverName)) {
// MySQL兼容
return new MysqlDialect(dbConfig);
}
}
// 无法识别可支持的数据库类型默认使用ANSI方言可兼容大部分SQL语句

View File

@ -129,7 +129,9 @@ public class DriverIdentifier implements DriverNames{
new StartsWithDriverMatcher(DRIVER_GREENPLUM, "jdbc:pivotal:greenplum:"),
// 华为OpenGauss
new StartsWithDriverMatcher(DRIVER_GAUSS, "jdbc:zenith:"),
new StartsWithDriverMatcher(DRIVER_OPENGAUSS, "jdbc:opengauss:")
new StartsWithDriverMatcher(DRIVER_OPENGAUSS, "jdbc:opengauss:"),
// 中兴GoldenDB
new StartsWithDriverMatcher(DRIVER_GOLDENDB, "jdbc:goldendb:")
);
}

View File

@ -253,4 +253,8 @@ public interface DriverNames {
*/
String DRIVER_GREENPLUM = "com.pivotal.jdbc.GreenplumDriver";
/**
* JDBC 驱动 GoldenDB
*/
String DRIVER_GOLDENDB = "com.goldendb.jdbc.Driver";
}

View File

@ -60,6 +60,7 @@ public class DriverUtilTest {
map.put("jdbc:mariadb:", "org.mariadb.jdbc.Driver");
map.put("jdbc:hive2:", "org.apache.hive.jdbc.HiveDriver");
map.put("jdbc:hive:", "org.apache.hadoop.hive.jdbc.HiveDriver");
map.put("jdbc:goldendb:", "com.goldendb.jdbc.Driver");
map.forEach((k, v) -> Assertions.assertEquals(v,
DriverUtil.identifyDriver(k + RandomUtil.randomStringLower(2))));