jd-opensource/joyagent-jdgenie · error · JdbcBizException
暂不支持
Error message
%s 暂不支持
What it means
JdbcConnectionPoolFactory.createPooledDatasource builds a pooled datasource per JDBC dialect. MYSQL, H2 and CLICKHOUSE are handled via HikariCP; any other dialect hits the default branch and throws JdbcBizException '<dialect> 暂不支持'. It is an explicit unsupported-database-type guard.
Solutions
- Set jdbcDialect to one of MYSQL, H2 or CLICKHOUSE in the connection config.
- Add a case branch for the new dialect in createPooledDatasource (e.g. create PostgreSQL Hikari datasource).
- Check the DialectEnum value actually maps to the intended database.
- Validate the dialect value early (e.g. DialectEnum.of) before reaching the factory.
Example fix
// before
config.setJdbcDialect("POSTGRESQL"); // throws 暂不支持
// after
config.setJdbcDialect("MYSQL"); // supported dialect
// or extend the factory:
case POSTGRESQL: datasourceWrapper.setDataSource(createHikariDatasource(connConfig, jdbcDialect)); break; Defensive patterns
Strategy: validation
Validate before calling
// Java: check the dialect is supported before creating a pool
Set<String> SUPPORTED = Set.of("MYSQL", "H2", "CLICKHOUSE");
if (!SUPPORTED.contains(connConfig.getJdbcDialect().toUpperCase())) {
throw new IllegalArgumentException("unsupported dialect: " + connConfig.getJdbcDialect());
} Try / catch
try {
DatasourceWrapper ds = factory.createPooledDatasource(connConfig);
} catch (JdbcBizException e) {
log.error("Unsupported dialect: {}", connConfig.getJdbcDialect(), e);
// surface a config error to the operator
} Prevention
- Whitelist dialects at config-load time with DialectEnum.of.
- Extend the factory switch when adding a new database type.
- Keep dialect strings in an enum, not free-form config strings.
- Add a startup config check that fails fast on unsupported dialects.
When it happens
Trigger: Calling createPooledDatasource with a JdbcConnectionConfig whose jdbcDialect is not MYSQL, H2, or CLICKHOUSE (e.g. POSTGRESQL, ORACLE, or an unknown string).
Common situations: Adding a new database type to config without extending the factory, typo in dialect name, or reusing a config from another service that supports more dialects.
Related errors
- 创建数据源失败
- Failed listing database in catalog
- Failed getting table
- Could not find any jdbc dialect factories that implement
- Could not find any jdbc dialect factory that can handled
AI-assisted analysis of jd-opensource/joyagent-jdgenie@2417e0b8b6 (2026-09-08).
Data as JSON: /api/errors/a603be686409b108.
Report an issue: GitHub.
Appendix: source
Thrown at genie-backend/src/main/java/com/jd/genie/data/jdbc/connection/JdbcConnectionPoolFactory.java:43
public DatasourceWrapper createPooledDatasource(JdbcConnectionConfig connConfig) {
JdbcDialect jdbcDialect = JdbcDialectLoader.load(connConfig.getUrl());
DatasourceWrapper datasourceWrapper = new DatasourceWrapper();
datasourceWrapper.setJdbcDialect(jdbcDialect);
JdbcCatalog catalog = JdbcCatalogLoader.load(jdbcDialect.dialectName());
datasourceWrapper.setCatalog(catalog);
datasourceWrapper.setFreshTime(connConfig.getFreshTimestamp());
//set jdbc dialect
connConfig.setJdbcDialect(jdbcDialect.dialectName());
switch (connConfig.getJdbcDialect()) {
case MYSQL:
case H2:
case CLICKHOUSE:
datasourceWrapper.setDataSource(createHikariDatasource(connConfig, jdbcDialect));
break;
default:
throw new JdbcBizException(String.format("%s 暂不支持", connConfig.getJdbcDialect()));
}
return datasourceWrapper;
}
private DataSource createHikariDatasource(JdbcConnectionConfig connConfig, JdbcDialect jdbcDialect) {
HikariConfig config = new HikariConfig();
config.setPoolName(CONNECTION_POOL_PREFIX + connConfig.getKey());
config.setDriverClassName(jdbcDialect.driverName());
config.setUsername(connConfig.getUserName());
config.setPassword(connConfig.getPassword());
config.setJdbcUrl(connConfig.getUrl());
if (connConfig.getReadOnly() != null) {
config.setReadOnly(connConfig.getReadOnly());
}
if (connConfig.getConnectionTimeout() != null) {
config.setConnectionTimeout((connConfig.getConnectionTimeout()));
}View on GitHub (pinned to 2417e0b8b6)