{"record":{"id":"b5d8746fe07ab1c3","repo":"jeecgboot/JeecgBoot","slug":"driverclassname","errorCode":null,"errorMessage":"不支持的数据库驱动【{driverClassName}】，如需支持请联系管理员","messagePattern":"不支持的数据库驱动【(.+?)】，如需支持请联系管理员","errorType":"validation","errorClass":"JeecgBootException","httpStatus":null,"severity":"error","filePath":"jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/security/JdbcSecurityUtil.java","lineNumber":133,"sourceCode":"        }\n    }\n\n    /**\n     * 校验驱动类名是否在白名单中\n     *\n     * @param driverClassName JDBC 驱动类名\n     * @throws JeecgBootException 驱动不在白名单时抛出\n     */\n    public static void validateDriver(String driverClassName) {\n        if (oConvertUtils.isEmpty(driverClassName)) {\n            throw new JeecgBootException(\"数据库驱动类名不能为空\");\n        }\n        for (String allowed : ALLOWED_DRIVERS) {\n            if (allowed.equals(driverClassName)) {\n                return;\n            }\n        }\n        throw new JeecgBootException(\"不支持的数据库驱动【\" + driverClassName + \"】，如需支持请联系管理员\");\n    }\n}","sourceCodeStart":115,"sourceCodeEnd":135,"githubUrl":"https://github.com/jeecgboot/JeecgBoot/blob/96fb33f5ec68516da0b0147da06b2eb0419e063a/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/security/JdbcSecurityUtil.java#L115-L135","documentation":"Thrown by JdbcSecurityUtil.validateDriver() when the provided driverClassName does not match any entry in the ALLOWED_DRIVERS whitelist (15 supported drivers: MySQL, Oracle, SQLServer, MariaDB, PostgreSQL, DM, KingBase, Oscar, SQLite, DB2, HSQLDB, Derby, H2). The whitelist uses exact String equals matching (case-sensitive). This prevents loading arbitrary JDBC driver classes that could enable RCE or other attacks.","triggerScenarios":"Providing a driver class name not in the whitelist — e.g., a custom driver, a newer/older driver with a different class name, or a third-party driver. Also triggered by typos in the driver class name (e.g., 'com.mysql.cj.jdbc.driver' instead of 'com.mysql.cj.jdbc.Driver' — note case).","commonSituations":"Using a database not in the whitelist (e.g., ClickHouse, Redis JDBC, Neo4j); driver class name has a typo or wrong case; using a new driver version with a relocated class name; admin copy-pastes a driver name from an outdated tutorial.","solutions":["Verify the exact driver class name against the ALLOWED_DRIVERS array in JdbcSecurityUtil.java — matching is case-sensitive and exact.","If you need an unsupported database, add its driver class name to the ALLOWED_DRIVERS array and rebuild.","Check for common typos: 'Driver' vs 'driver', missing package prefixes, extra whitespace."],"exampleFix":"// before — typo in driver class name\nsysDataSource.setDbDriver(\"com.mysql.cj.jdbc.driver\"); // lowercase 'd'\nJdbcSecurityUtil.validateDriver(sysDataSource.getDbDriver()); // throws\n\n// after — exact match\nsysDataSource.setDbDriver(\"com.mysql.cj.jdbc.Driver\"); // capital 'D'\nJdbcSecurityUtil.validateDriver(sysDataSource.getDbDriver()); // passes\n\n// If you need a new driver, add to JdbcSecurityUtil.ALLOWED_DRIVERS:\n//   \"com.clickhouse.jdbc.ClickHouseDriver\"","handlingStrategy":"validation","validationCode":"// Verify driver class name is in ALLOWED_DRIVERS before calling validateDriver\nSet<String> allowed = new HashSet<>(Arrays.asList(\n    \"com.mysql.cj.jdbc.Driver\", \"org.postgresql.Driver\", \"oracle.jdbc.OracleDriver\"/*...*/));\nif (!allowed.contains(driverClassName)) {\n    return Result.error(\"不支持的驱动: \" + driverClassName);\n}","typeGuard":null,"tryCatchPattern":"try {\n    JdbcSecurityUtil.validateDriver(driverClassName);\n} catch (JeecgBootException e) {\n    log.warn(\"Driver not in whitelist: {}\", driverClassName);\n    return Result.error(e.getMessage());\n}","preventionTips":["Use the exact driver class name from the ALLOWED_DRIVERS list — matching is case-sensitive.","If a new database type is needed, add its driver to ALLOWED_DRIVERS and rebuild.","Copy driver class names directly from the JdbcSecurityUtil source to avoid typos."],"tags":["jdbc","whitelist","validation","datasource","security"],"backgroundTag":null,"analyzedSha":"96fb33f5ec68516da0b0147da06b2eb0419e063a","analyzedAt":"2026-08-14T00:04:16.786Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}