{"record":{"id":"61b4b4ab3d1dc909","repo":"baomidou/mybatis-plus","slug":"unsupported-database-type","errorCode":null,"errorMessage":"Unsupported database type: {}","messagePattern":"Unsupported database type: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/ddl/DdlHelper.java","lineNumber":262,"sourceCode":"    }\n\n    protected static IDdlGenerator getDdlGenerator(String jdbcUrl) throws RuntimeException {\n        DbType dbType = JdbcUtils.getDbType(jdbcUrl);\n        // mysql same type\n        if (dbType.mysqlSameType()) {\n            return MysqlDdlGenerator.newInstance();\n        }\n        // oracle same type\n        else if (dbType.oracleSameType()) {\n            return OracleDdlGenerator.newInstance();\n        } else if (DbType.SQLITE == dbType) {\n            return SQLiteDdlGenerator.newInstance();\n        }\n        // postgresql same type\n        else if (dbType.postgresqlSameType()) {\n            return PostgreDdlGenerator.newInstance();\n        }\n        throw new RuntimeException(\"Unsupported database type: \" + jdbcUrl);\n    }\n\n    public static String getDatabase(String jdbcUrl) {\n        String[] urlArr = jdbcUrl.split(\"://\");\n        if (urlArr.length == 2) {\n            String[] dataArr = urlArr[1].split(\"/\");\n            if (dataArr.length > 1) {\n                return dataArr[1].split(\"\\\\?\")[0];\n            }\n        }\n        return null;\n    }\n}\n","sourceCodeStart":244,"sourceCodeEnd":276,"githubUrl":"https://github.com/baomidou/mybatis-plus/blob/bf67d907478c724120bf76292da54abf9e73c2b3/mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/ddl/DdlHelper.java#L244-L276","documentation":"DdlHelper.newDdlGenerator (the private factory shown) maps the DbType parsed from a JDBC URL to a DDL generator: MySQL family, Oracle family, SQLite, PostgreSQL family. Any other DbType falls through to RuntimeException('Unsupported database type: <jdbcUrl>'). It means you invoked the DDL/dataset-component (e.g. the simple data-script runner) against a database for which no DDL generator ships.","triggerScenarios":"Calling DdlHelper-based APIs (getSimpleConnection, newDdlGenerator — used by the extension's DDL application/dataset module) while connected to H2, SQL Server, DM, Kingbase, ClickHouse, MariaDB-with-unrecognized-URL, or any DbType outside the four supported families.","commonSituations":"Using the DDL helper during local tests on H2; pointing the tool at SQL Server or a Chinese domestic database (DM/OceanBase/Gauss) that is not in the generator map; a JDBC URL whose DbType detection resolves to something unexpected.","solutions":["Use one of the supported databases for DDL operations: MySQL-family, Oracle-family, SQLite, or PostgreSQL-family.","If you must target an unsupported DB, run your DDL scripts through that database's native tooling or plain JDBC ScriptRunner instead of DdlHelper.","Check the DbType detection of your JDBC URL (DbType.getDbType(url)) to confirm which branch is (not) taken.","Contribute or extend with a custom DdlGenerator if you depend on this API long-term."],"exampleFix":"// before: H2 test URL -> RuntimeException('Unsupported database type')\nString url = \"jdbc:h2:mem:test\";\ntry (Connection c = DdlHelper.getSimpleConnection(driver, url, u, p)) { ... }\n\n// after: run DDL over plain JDBC for unsupported DBs\ntry (Connection c = DriverManager.getConnection(url, u, p);\n     Statement st = c.createStatement()) {\n    st.execute(\"CREATE TABLE t (id BIGINT PRIMARY KEY)\");\n}","handlingStrategy":"validation","validationCode":"DbType dbType = DbType.getDbType(jdbcUrl);\nboolean ddlSupported = dbType.mysqlSameType() || dbType.oracleSameType()\n    || DbType.SQLITE == dbType || dbType.postgresqlSameType();\nif (!ddlSupported) throw new UnsupportedOperationException(\"DDL helper unsupported for \" + dbType);","typeGuard":"static boolean supportsDdlHelper(DbType t) {\n    return t.mysqlSameType() || t.oracleSameType()\n        || t.postgresqlSameType() || DbType.SQLITE == t;\n}","tryCatchPattern":"try {\n    generator = DdlHelper.newDdlGenerator(driver, url, u, p);\n} catch (RuntimeException e) {\n    if (String.valueOf(e.getMessage()).startsWith(\"Unsupported database type\")) {\n        // route to plain JDBC script execution instead\n    } else throw e;\n}","preventionTips":["Check DbType.getDbType(url) against the supported families before invoking DDL APIs.","Keep DDL execution on MySQL/Oracle/SQLite/PostgreSQL family databases or use native tooling."],"tags":["ddl","database-support","jdbc","configuration"],"backgroundTag":null,"analyzedSha":"bf67d907478c724120bf76292da54abf9e73c2b3","analyzedAt":"2026-08-14T15:17:09.543Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}