{"record":{"id":"b026c8bb73dcc274","repo":"flowable/flowable-engine","slug":"couldn-t-deduct-database-type-from-database-produc-b026c8","errorCode":null,"errorMessage":"couldn't deduct database type from database product name '${databaseProductName}'","messagePattern":"couldn't deduct database type from database product name '(.+?)'","errorType":"exception","errorClass":"ActivitiException","httpStatus":null,"severity":"critical","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cfg/ProcessEngineConfigurationImpl.java","lineNumber":825,"sourceCode":"        databaseTypeMappings.setProperty(\"DB2/HP64\", DATABASE_TYPE_DB2);\n        databaseTypeMappings.setProperty(\"DB2/SUN\", DATABASE_TYPE_DB2);\n        databaseTypeMappings.setProperty(\"DB2/SUN64\", DATABASE_TYPE_DB2);\n        databaseTypeMappings.setProperty(\"DB2/PTX\", DATABASE_TYPE_DB2);\n        databaseTypeMappings.setProperty(\"DB2/2\", DATABASE_TYPE_DB2);\n        databaseTypeMappings.setProperty(\"DB2 UDB AS400\", DATABASE_TYPE_DB2);\n        return databaseTypeMappings;\n    }\n\n    public void initDatabaseType() {\n        Connection connection = null;\n        try {\n            connection = dataSource.getConnection();\n            DatabaseMetaData databaseMetaData = connection.getMetaData();\n            String databaseProductName = databaseMetaData.getDatabaseProductName();\n            LOGGER.debug(\"database product name: '{}'\", databaseProductName);\n            databaseType = databaseTypeMappings.getProperty(databaseProductName);\n            if (databaseType == null) {\n                throw new ActivitiException(\"couldn't deduct database type from database product name '\" + databaseProductName + \"'\");\n            }\n            LOGGER.debug(\"using database type: {}\", databaseType);\n\n        } catch (SQLException e) {\n            LOGGER.error(\"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\n    // myBatis SqlSessionFactory ////////////////////////////////////////////////\n","sourceCodeStart":807,"sourceCodeEnd":843,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cfg/ProcessEngineConfigurationImpl.java#L807-L843","documentation":"During database initialization the engine connects to the datasource, reads DatabaseMetaData.getDatabaseProductName(), and maps it via databaseTypeMappings to an internal databaseType (h2, mysql, postgres, oracle, etc.). If the product name has no mapping, initDatabaseType throws this ActivitiException because the engine cannot select database-specific SQL.","triggerScenarios":"Connecting to a database whose product name string is not in the mapping table — uncommon databases, forks/embedded engines with custom product names, or new major DB versions with renamed product strings in older Activiti versions.","commonSituations":"Using an unsupported/rare DB (e.g. some cloud or sharded proxies that alter the product name); newer database versions whose product name changed vs. the engine version; proxies like PgBouncer variants reporting unusual metadata.","solutions":["Upgrade to an Activiti/Flowable version that supports your database","Explicitly set databaseType on the configuration (e.g. cfg.setDatabaseType(\"postgres\")) to skip auto-detection","If using a proxy/brand, check the reported product name via JDBC metadata and set databaseType to the underlying DB type","Extend databaseTypeMappings programmatically (DatabaseTypeMappings property) before engine init if you must support a custom DB"],"exampleFix":"// before\nJtaProcessEngineConfiguration cfg = ...; // auto-detect fails for new DB\n// after\ncfg.setDatabaseType(\"mysql\"); // skip product-name detection\ncfg.buildProcessEngine();","handlingStrategy":"validation","validationCode":"try (Connection c = cfg.getDataSource().getConnection()) {\n  String product = c.getMetaData().getDatabaseProductName();\n  Set<String> supported = Set.of(\"H2\", \"MySQL\", \"PostgreSQL\", \"Oracle\", \"Microsoft SQL Server\", \"DB2\");\n  if (supported.stream().noneMatch(product::contains) && cfg.getDatabaseType() == null) {\n    throw new IllegalStateException(\"Unsupported DB product '\" + product + \"': set databaseType explicitly\");\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  processEngine = cfg.buildProcessEngine();\n} catch (ActivitiException e) {\n  if (e.getMessage().startsWith(\"couldn't deduct database type\")) {\n    cfg.setDatabaseType(\"postgres\"); // or appropriate type\n    processEngine = cfg.buildProcessEngine();\n  } else throw e;\n}","preventionTips":["Set databaseType explicitly when using proxies or uncommon databases","Keep engine version compatible with your DB version","Print getDatabaseProductName() during environment validation","Upgrade Flowable/Activiti when adopting a new database release"],"tags":["activiti","database","configuration"],"backgroundTag":"unsupported-platform","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}