alibaba/DataX · error · IllegalArgumentException

JDBC Type: {sqlType}

Error message

JDBC Type: {sqlType}

What it means

Thrown from the switch in ColumnDataType that converts a java.sql.Types constant into a ColumnDataType (e.g. Types.DOUBLE -> DOUBLE). Any JDBC type code without an explicit case (NULL is commented out; BLOB, BIT, ARRAY, STRUCT etc. are absent) falls to default and raises IllegalArgumentException('JDBC Type: ' + sqlType). This occurs while mapping ADS table metadata read over JDBC.

Source

Thrown at adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/ads/ColumnDataType.java:250

            case Types.TINYINT:
                return BYTE;
            case Types.BIGINT:
                return LONG;
            case Types.REAL:
                return FLOAT;
            case Types.DOUBLE:
            case Types.FLOAT:
                return DOUBLE;
            case Types.DATE:
                return DATE;
            case Types.TIME:
                return TIME;
            case Types.TIMESTAMP:
                return TIMESTAMP;
                // case Types.NULL:
                // return NULL;
            default:
                throw new IllegalArgumentException("JDBC Type: " + sqlType);
        }
    }

    /**
     * Get the value type for the given Java class.
     * 
     * @param x the Java class
     * @return the value type
     */
    public static int getTypeFromClass(Class<?> x) {
        // if (x == null || Void.TYPE == x) {
        // return NULL;
        // }
        if (x.isPrimitive()) {
            x = getNonPrimitiveClass(x);
        }
        if (String.class == x) {
            return STRING;

View on GitHub (pinned to 80ec23d5c5)

Solutions

  1. Identify the numeric sqlType from the message and look it up in java.sql.Types to find which column type it is.
  2. Describe the ADS table and locate the offending column; alter it to a supported type or exclude it from the write column list.
  3. If the type is legitimately supported by your ADS version, add a case mapping it in this switch and rebuild adswriter.
  4. Re-enable Types.NULL handling if the message shows type 0.

Example fix

-- before: table has unsupported column
ALTER TABLE t ADD COLUMN raw BLOB;
-- after: use supported type
ALTER TABLE t ADD COLUMN raw VARCHAR(4096);
Defensive patterns

Strategy: type-guard

Validate before calling

static final Set<Integer> SUPPORTED_SQL_TYPES = new HashSet<>(Arrays.asList(
    Types.VARCHAR, Types.CHAR, Types.LONGVARCHAR, Types.INTEGER, Types.BIGINT,
    Types.SMALLINT, Types.TINYINT, Types.DECIMAL, Types.NUMERIC,
    Types.REAL, Types.DOUBLE, Types.FLOAT, Types.DATE, Types.TIME, Types.TIMESTAMP));
boolean isSupportedJdbcType(int sqlType) { return SUPPORTED_SQL_TYPES.contains(sqlType); }

Type guard

boolean columnTypeSupported(ResultSetMetaData md, int col) throws SQLException {
    return isSupportedJdbcType(md.getColumnType(col));
}

Try / catch

try {
    ColumnDataType dt = ColumnDataType.fromJdbcType(sqlType);
} catch (IllegalArgumentException e) {
    throw new SQLException("target table has unsupported column JDBC type: " + e.getMessage(), e);
}

Prevention

When it happens

Trigger: Reading table metadata (getTableInfo / ResultSetMetaData.getColumnType) for an ADS table containing a column whose JDBC type is not in the switch, such as BLOB, TINYINT variants, BIT, DISTINCT, or Types.NULL for an all-null computed column.

Common situations: The target ADS table has a column type the writer predates (schema evolved, e.g. a new binary/json type), or a column whose driver-reported type is Types.NULL/-0 because it is fully nulled out at metadata time.

Related errors


AI-assisted analysis of alibaba/DataX@80ec23d5c5 (2026-08-14). Data as JSON: /api/errors/f049b78fe8a10312. Report an issue: GitHub.