{"record":{"id":"68ca8ec2a736506b","repo":"YunaiV/ruoyi-vue-pro","slug":"cannot-determine-the-oracle-database-version-numbe","errorCode":null,"errorMessage":"Cannot determine the Oracle database version number","messagePattern":"Cannot determine the Oracle database version number","errorType":"exception","errorClass":"UnexpectedLiquibaseException","httpStatus":null,"severity":"error","filePath":"sql/dm/flowable-patch/src/main/java/liquibase/database/core/DmDatabase.java","lineNumber":594,"sourceCode":"\n    /**\n     * Returns the maximum number of bytes (NOT: characters) for an identifier. For Oracle <=12c Release 20, this\n     * is 30 bytes, and starting from 12cR2, up to 128 (except for tablespaces, PDB names and some other rather rare\n     * object types).\n     *\n     * @return the maximum length of an object identifier, in bytes\n     */\n    public int getIdentifierMaximumLength() {\n        try {\n            if (getDatabaseMajorVersion() < ORACLE_12C_MAJOR_VERSION) {\n                return SHORT_IDENTIFIERS_LENGTH;\n            } else if ((getDatabaseMajorVersion() == ORACLE_12C_MAJOR_VERSION) && (getDatabaseMinorVersion() <= 1)) {\n                return SHORT_IDENTIFIERS_LENGTH;\n            } else {\n                return LONG_IDENTIFIERS_LEGNTH;\n            }\n        } catch (DatabaseException ex) {\n            throw new UnexpectedLiquibaseException(\"Cannot determine the Oracle database version number\", ex);\n        }\n\n    }\n}\n","sourceCodeStart":576,"sourceCodeEnd":599,"githubUrl":"https://github.com/YunaiV/ruoyi-vue-pro/blob/0418084e222612af2fc1141f566af454f9236ab1/sql/dm/flowable-patch/src/main/java/liquibase/database/core/DmDatabase.java#L576-L599","documentation":"Thrown by DmDatabase (a Liquibase Database implementation for Dameng DB, which mirrors Oracle) when getIdentifierMaximumLength() cannot read the database major/minor version. The method calls getDatabaseMajorVersion()/getDatabaseMinorVersion(), which raise DatabaseException if the JDBC driver does not report a parseable version string. The catch wraps it as an UnexpectedLiquibaseException, halting the Liquibase changelog parse/identifier-length decision.","triggerScenarios":"Running a Liquibase update against a Dameng/Oracle-compatible DB whose JDBC driver returns null or a malformed version from DatabaseMetaData.getDatabaseMajorVersion(); connecting before the DB is fully started so metadata calls fail; using an older DmJdbcDriver that does not implement version metadata.","commonSituations":"Upgrading the Dameng JDBC driver to a build that changed the version metadata format; pointing Flowable/Liquibase at a standby or read-only replica that refuses metadata queries; CI containers where the DB is queried before init scripts finish.","solutions":["Upgrade the Dameng JDBC driver (DmJdbcDriver) to a version that correctly reports database major/minor version metadata.","Verify the connection is healthy and the instance is fully started before Liquibase runs (e.g. a readiness check on the datasource).","Check the caused-by DatabaseException in the stack trace to see which metadata call (getDatabaseMajorVersion vs getDatabaseMinorVersion) failed and what string the driver returned.","If the version truly cannot be detected, override DmDatabase.getDatabaseMajorVersion()/getDatabaseMinorVersion() in the patch to return a known constant for your target DM version."],"exampleFix":"// before: rely on driver metadata which may be missing\nreturn getDatabaseMajorVersion();\n// after: fall back to a configured/default DM major version\nint major;\ntry {\n    major = getDatabaseMajorVersion();\n} catch (DatabaseException e) {\n    major = DEFAULT_DM_MAJOR_VERSION;\n}\nreturn major;","handlingStrategy":"try-catch","validationCode":"// before engine init, probe metadata once\ntry (Connection c = dataSource.getConnection()) {\n    int major = c.getMetaData().getDatabaseMajorVersion();\n    if (major <= 0) throw new IllegalStateException(\"Driver returned invalid DB major version\");\n} catch (SQLException e) {\n    throw new IllegalStateException(\"DB not ready for metadata queries\", e);\n}","typeGuard":"null","tryCatchPattern":"try {\n    return database.getIdentifierMaximumLength();\n} catch (UnexpectedLiquibaseException e) {\n    log.warn(\"DM version undetectable, defaulting identifier length\", e);\n    return LONG_IDENTIFIERS_LEGNTH;\n}","preventionTips":["Run a connection/metadata readiness check before Liquibase starts","Pin a DmJdbcDriver version known to report version metadata","Smoke-test getDatabaseMajorVersion() in a startup health check"],"tags":["liquibase","dameng","oracle","database-metadata","version-detection"],"backgroundTag":null,"analyzedSha":"0418084e222612af2fc1141f566af454f9236ab1","analyzedAt":"2026-08-14T00:56:18.412Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}