{"record":{"id":"4303ddfdfc8c36e4","repo":"alibaba/DataX","slug":"103","errorCode":"-103","errorMessage":"ADS JDBC connection schema was not set.","messagePattern":"ADS JDBC connection schema was not set\\.","errorType":"error_code","errorClass":"AdsException","httpStatus":null,"severity":"error","filePath":"adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/load/AdsHelper.java","lineNumber":107,"sourceCode":"            throw new AdsException(AdsException.ADS_TABLEMETA_TABLE_NULL, \"Table is null.\", null);\n        }\n\n        if (adsURL == null) {\n            throw new AdsException(AdsException.ADS_CONN_URL_NOT_SET, \"ADS JDBC connection URL was not set.\", null);\n        }\n\n        if (userName == null) {\n            throw new AdsException(AdsException.ADS_CONN_USERNAME_NOT_SET,\n                    \"ADS JDBC connection user name was not set.\", null);\n        }\n\n        if (password == null) {\n            throw new AdsException(AdsException.ADS_CONN_PASSWORD_NOT_SET, \"ADS JDBC connection password was not set.\",\n                    null);\n        }\n\n        if (schema == null) {\n            throw new AdsException(AdsException.ADS_CONN_SCHEMA_NOT_SET, \"ADS JDBC connection schema was not set.\",\n                    null);\n        }\n\n        Connection connection = null;\n        Statement statement = null;\n        ResultSet rs = null;\n        try {\n            Class.forName(\"com.mysql.jdbc.Driver\");\n            String url = AdsUtil.prepareJdbcUrl(this.adsURL, this.schema, this.socketTimeout, this.suffix);\n\n            Properties connectionProps = new Properties();\n            connectionProps.put(\"user\", userName);\n            connectionProps.put(\"password\", password);\n            connection = DriverManager.getConnection(url, connectionProps);\n            statement = connection.createStatement();\n            // ads 表名、schema名不区分大小写, 提高用户易用性, 注意列顺序性\n            String columnMetaSql = String.format(\"select ordinal_position,column_name,data_type,type_name,column_comment from information_schema.columns where table_schema = `'%s'` and table_name = `'%s'` order by ordinal_position\", schema.toLowerCase(), table.toLowerCase());\n            LOG.info(String.format(\"检查列信息sql语句:%s\", columnMetaSql));","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/alibaba/DataX/blob/80ec23d5c5328eb90ca364d2749e92dfaf44541e/adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/load/AdsHelper.java#L89-L125","documentation":"Fifth guard in getTableInfo: a null schema throws AdsException code -103 (ADS_CONN_SCHEMA_NOT_SET). ADS organizes tables under a schema, and the helper needs it to build both the JDBC URL suffix and metadata queries.","triggerScenarios":"The adswriter parameter block lacks the 'schema' key, so AdsHelper.schema is null when metadata is requested.","commonSituations":"Users migrating from MySQL-style configs who omit schema; the ADS schema name differs from the database in the URL; key misspelled.","solutions":["Add 'schema' with the ADS schema name (often the database name) to the adswriter parameter block.","Confirm the schema exists in ADS (SHOW SCHEMAS / check console) and matches the table being written.","If calling AdsHelper directly, set schema before getTableInfo."],"exampleFix":"// before\n{\"parameter\":{\"url\":\"...\",\"username\":\"u\",\"password\":\"p\"}}\n// after\n{\"parameter\":{\"url\":\"...\",\"username\":\"u\",\"password\":\"p\",\"schema\":\"my_schema\"}}","handlingStrategy":"validation","validationCode":"if (config.getString(\"schema\") == null) {\n    throw new IllegalStateException(\"adswriter 'schema' key is required\");\n}","typeGuard":"boolean isSchemaSet(String s) { return s != null && !s.trim().isEmpty(); }","tryCatchPattern":"try {\n    return helper.getTableInfo(table);\n} catch (AdsException e) {\n    if (e.getCode() == AdsException.ADS_CONN_SCHEMA_NOT_SET) {\n        throw new IllegalStateException(\"job config: ADS 'schema' missing\", e);\n    }\n    throw e;\n}","preventionTips":["Remember ADS needs schema in addition to database - it is not inferred from the JDBC URL.","Verify schema names in the ADS console and copy them exactly (case-sensitive).","Include schema in the required-fields lint for every adswriter job."],"tags":["adswriter","config","schema","validation"],"backgroundTag":null,"analyzedSha":"80ec23d5c5328eb90ca364d2749e92dfaf44541e","analyzedAt":"2026-08-14T15:33:51.187Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}