apache/incubator-seata · error · IllegalArgumentException

"Unsupported DB type: " + dbType

Error message

"Unsupported DB type: " + dbType

What it means

PageUtil.getDateTimeStartSql builds a datetime-typed lower-bound fragment (FROM_UNIXTIME for mysql, TO_TIMESTAMP/NUMTODSINTERVAL for oracle/dm/oscar, DATEADD for sqlserver, etc.). Its default branch throws IllegalArgumentException("Unsupported DB type: " + dbType) for any dialect outside the switch — note this message differs from the older "is not supported yet" variants.

Source

Thrown at common/src/main/java/org/apache/seata/common/util/PageUtil.java:247

     */
    public static String getDateTimeStartSql(String dbType, String timeColumnName) {
        switch (dbType.toLowerCase()) {
            case "mysql":
                return " and UNIX_TIMESTAMP(" + timeColumnName + ") >= ? ";
            case "postgresql":
                return " and " + timeColumnName + " >= TO_TIMESTAMP(?) ";
            case "oracle":
                return " and " + timeColumnName
                        + " >= TO_TIMESTAMP('1970-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS') + NUMTODSINTERVAL(?, 'SECOND') ";
            case "sqlserver":
                return " and " + timeColumnName + " >= DATEADD(SECOND, ?, '1970-01-01 00:00:00') ";
            case "dm":
            case "oscar":
                // Compatible with Oracle syntax
                return " and " + timeColumnName
                        + " >= TO_TIMESTAMP('1970-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS') + NUMTODSINTERVAL(?, 'SECOND') ";
            default:
                throw new IllegalArgumentException("Unsupported DB type: " + dbType);
        }
    }

    /**
     * get sql for time end (The database fields is of type datetime)
     * @param dbType
     * @param timeColumnName
     * @return java.lang.String
     */
    public static String getDateTimeEndSql(String dbType, String timeColumnName) {
        switch (dbType.toLowerCase()) {
            case "mysql":
                return " and UNIX_TIMESTAMP(" + timeColumnName + ") <= ? ";
            case "postgresql":
                return " and " + timeColumnName + " <= TO_TIMESTAMP(?) ";
            case "oracle":
                return " and " + timeColumnName
                        + " <= TO_TIMESTAMP('1970-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS') + NUMTODSINTERVAL(?, 'SECOND') ";

View on GitHub (pinned to e01f97c6db)

Solutions

  1. Use a dbType covered by getDateTimeStartSql in your Seata version
  2. Verify the schema type matches the method family: epoch columns use getTimeStartSql, DATETIME columns use getDateTimeStartSql
  3. Update Seata to a version whose dialect list includes your database, or patch the switch upstream

Example fix

# before
store.db.dbType = h2 // getDateTimeStartSql throws 'Unsupported DB type'

# after
store.db.dbType = mysql
Defensive patterns

Strategy: type-guard

Validate before calling

Set<String> DT_DB = Set.of("mysql", "oracle", "sqlserver", "dm", "oscar"); // verify against your version
if (!DT_DB.contains(dbType)) throw new ConfigurationException("datetime filters unsupported: " + dbType);

Type guard

static boolean supportsDatetimeFilter(String dbType) { return dbType != null && Set.of("mysql","oracle","sqlserver","dm","oscar").contains(dbType.toLowerCase()); }

Try / catch

try { frag = PageUtil.getDateTimeStartSql(dbType, col); } catch (IllegalArgumentException e) { throw new ConfigurationException("datetime filters unsupported on " + dbType, e); }

Prevention

When it happens

Trigger: Calling getDateTimeStartSql(dbType, timeColumnName) with a dbType absent from the case list (check the file for the exact set — typically mysql, oracle, sqlserver, dm, oscar, plus datetime-capable branches such as postgresql) while running console queries where the time column is of type datetime rather than epoch millis.

Common situations: Switching the store schema from BIGINT epoch columns to DATETIME columns while the dbType or dialect branch for your database is missing; custom stores reusing PageUtil for datetime filters.

Related errors


AI-assisted analysis of apache/incubator-seata@e01f97c6db (2026-08-14). Data as JSON: /api/errors/64cfbb776e335c87. Report an issue: GitHub.