{"record":{"id":"99450897d7f4da13","repo":"YunaiV/ruoyi-vue-pro","slug":"couldn-t-deduct-database-type-from-database-produc","errorCode":null,"errorMessage":"couldn't deduct database type from database product name '{}'","messagePattern":"couldn't deduct database type from database product name '(.+?)'","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"critical","filePath":"sql/dm/flowable-patch/src/main/java/org/flowable/common/engine/impl/AbstractEngineConfiguration.java","lineNumber":522,"sourceCode":"            // CRDB does not expose the version through the jdbc driver, so we need to fetch it through version().\n            if (PRODUCT_NAME_POSTGRES.equalsIgnoreCase(databaseProductName)) {\n                try (PreparedStatement preparedStatement = connection.prepareStatement(\"select version() as version;\");\n                     ResultSet resultSet = preparedStatement.executeQuery()) {\n                    String version = null;\n                    if (resultSet.next()) {\n                        version = resultSet.getString(\"version\");\n                    }\n\n                    if (StringUtils.isNotEmpty(version) && version.toLowerCase().startsWith(PRODUCT_NAME_CRDB.toLowerCase())) {\n                        databaseProductName = PRODUCT_NAME_CRDB;\n                        logger.info(\"CockroachDB version '{}' detected\", version);\n                    }\n                }\n            }\n\n            databaseType = databaseTypeMappings.getProperty(databaseProductName);\n            if (databaseType == null) {\n                throw new FlowableException(\"couldn't deduct database type from database product name '\" + databaseProductName + \"'\");\n            }\n            logger.debug(\"using database type: {}\", databaseType);\n\n        } catch (SQLException e) {\n            throw new RuntimeException(\"Exception while initializing Database connection\", e);\n        } finally {\n            try {\n                if (connection != null) {\n                    connection.close();\n                }\n            } catch (SQLException e) {\n                logger.error(\"Exception while closing the Database connection\", e);\n            }\n        }\n\n        // Special care for MSSQL, as it has a hard limit of 2000 params per statement (incl bulk statement).\n        // Especially with executions, with 100 as default, this limit is passed.\n        if (DATABASE_TYPE_MSSQL.equals(databaseType)) {","sourceCodeStart":504,"sourceCodeEnd":540,"githubUrl":"https://github.com/YunaiV/ruoyi-vue-pro/blob/0418084e222612af2fc1141f566af454f9236ab1/sql/dm/flowable-patch/src/main/java/org/flowable/common/engine/impl/AbstractEngineConfiguration.java#L504-L540","documentation":"Flowable maps the JDBC DatabaseMetaData.getDatabaseProductName() string to an internal databaseType via databaseTypeMappings. If the product name is not a mapped key, databaseType is null and the engine cannot load the correct org/flowable/.../<type>.properties SQL dialect, throwing FlowableException.","triggerScenarios":"Connecting to a DB whose product name is unmapped (e.g. Dameng returns 'DM DBMS', a new Oracle build returns a slightly different string, or a proxy/wrapper driver alters the name); using a DB Flowable does not support out of the box.","commonSituations":"Adding Dameng/kingbase/opengauss support; JDBC driver upgrade changes the reported product name string; using a connection-pool/sharding middleware that rewrites metadata.","solutions":["Set configuration.setDatabaseType(...) explicitly to the Flowable dialect key (e.g. 'dm', 'mysql', 'oracle') to bypass product-name detection.","Register a mapping from the actual product name string to a Flowable databaseType via setDatabaseTypeMappings() before engine init.","Log databaseProductName at startup to see the exact string that failed, then map it.","Verify the JDBC driver is the correct one for your DB (a generic driver may report a generic product name)."],"exampleFix":"// before: relies on product-name auto-detection (fails for DM)\n// after: set the type explicitly\ncfg.setDatabaseType(\"dm\");\n// or extend the mapping:\nMap<String,String> m = new HashMap<>(cfg.getDatabaseTypeMappings());\nm.put(\"DM DBMS\", \"dm\");\ncfg.setDatabaseTypeMappings(m);","handlingStrategy":"validation","validationCode":"try (Connection c = dataSource.getConnection()) {\n    String name = c.getMetaData().getDatabaseProductName();\n    if (!knownFlowableTypes.contains(cfg.getDatabaseTypeMappings().get(name))) {\n        cfg.setDatabaseType(\"dm\"); // explicit override\n    }\n}","typeGuard":"null","tryCatchPattern":"try { engine = cfg.buildProcessEngine(); }\ncatch (FlowableException e) {\n    if (e.getMessage().contains(\"couldn't deduct database type\")) cfg.setDatabaseType(\"dm\");\n    throw e;\n}","preventionTips":["Set setDatabaseType() explicitly for non-standard DBs","Register a custom product-name -> databaseType mapping before engine init","Log the product name string from getMetaData() during onboarding a new DB"],"tags":["flowable","database-type","dialect","configuration"],"backgroundTag":null,"analyzedSha":"0418084e222612af2fc1141f566af454f9236ab1","analyzedAt":"2026-08-14T00:56:18.412Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}