{"record":{"id":"f049b78fe8a10312","repo":"alibaba/DataX","slug":"jdbc-type-sqltype","errorCode":null,"errorMessage":"JDBC Type: {sqlType}","messagePattern":"JDBC Type: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/ads/ColumnDataType.java","lineNumber":250,"sourceCode":"            case Types.TINYINT:\n                return BYTE;\n            case Types.BIGINT:\n                return LONG;\n            case Types.REAL:\n                return FLOAT;\n            case Types.DOUBLE:\n            case Types.FLOAT:\n                return DOUBLE;\n            case Types.DATE:\n                return DATE;\n            case Types.TIME:\n                return TIME;\n            case Types.TIMESTAMP:\n                return TIMESTAMP;\n                // case Types.NULL:\n                // return NULL;\n            default:\n                throw new IllegalArgumentException(\"JDBC Type: \" + sqlType);\n        }\n    }\n\n    /**\n     * Get the value type for the given Java class.\n     * \n     * @param x the Java class\n     * @return the value type\n     */\n    public static int getTypeFromClass(Class<?> x) {\n        // if (x == null || Void.TYPE == x) {\n        // return NULL;\n        // }\n        if (x.isPrimitive()) {\n            x = getNonPrimitiveClass(x);\n        }\n        if (String.class == x) {\n            return STRING;","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/alibaba/DataX/blob/80ec23d5c5328eb90ca364d2749e92dfaf44541e/adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/ads/ColumnDataType.java#L232-L268","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Identify the numeric sqlType from the message and look it up in java.sql.Types to find which column type it is.","Describe the ADS table and locate the offending column; alter it to a supported type or exclude it from the write column list.","If the type is legitimately supported by your ADS version, add a case mapping it in this switch and rebuild adswriter.","Re-enable Types.NULL handling if the message shows type 0."],"exampleFix":"-- before: table has unsupported column\nALTER TABLE t ADD COLUMN raw BLOB;\n-- after: use supported type\nALTER TABLE t ADD COLUMN raw VARCHAR(4096);","handlingStrategy":"type-guard","validationCode":"static final Set<Integer> SUPPORTED_SQL_TYPES = new HashSet<>(Arrays.asList(\n    Types.VARCHAR, Types.CHAR, Types.LONGVARCHAR, Types.INTEGER, Types.BIGINT,\n    Types.SMALLINT, Types.TINYINT, Types.DECIMAL, Types.NUMERIC,\n    Types.REAL, Types.DOUBLE, Types.FLOAT, Types.DATE, Types.TIME, Types.TIMESTAMP));\nboolean isSupportedJdbcType(int sqlType) { return SUPPORTED_SQL_TYPES.contains(sqlType); }","typeGuard":"boolean columnTypeSupported(ResultSetMetaData md, int col) throws SQLException {\n    return isSupportedJdbcType(md.getColumnType(col));\n}","tryCatchPattern":"try {\n    ColumnDataType dt = ColumnDataType.fromJdbcType(sqlType);\n} catch (IllegalArgumentException e) {\n    throw new SQLException(\"target table has unsupported column JDBC type: \" + e.getMessage(), e);\n}","preventionTips":["Pre-flight the ADS table schema and reject jobs whose columns include unsupported JDBC types.","After ADS schema changes, re-run a metadata check before scheduling writes.","Prefer common types (VARCHAR, BIGINT, DECIMAL, TIMESTAMP) when designing ADS tables for DataX."],"tags":["adswriter","jdbc","metadata","type-mapping"],"backgroundTag":null,"analyzedSha":"80ec23d5c5328eb90ca364d2749e92dfaf44541e","analyzedAt":"2026-08-14T15:33:51.187Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}