alibaba/DataX · error · AdsException
-103
-103
Error message
ADS JDBC connection schema was not set.
What it means
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.
Source
Thrown at adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/load/AdsHelper.java:107
throw new AdsException(AdsException.ADS_TABLEMETA_TABLE_NULL, "Table is null.", null);
}
if (adsURL == null) {
throw new AdsException(AdsException.ADS_CONN_URL_NOT_SET, "ADS JDBC connection URL was not set.", null);
}
if (userName == null) {
throw new AdsException(AdsException.ADS_CONN_USERNAME_NOT_SET,
"ADS JDBC connection user name was not set.", null);
}
if (password == null) {
throw new AdsException(AdsException.ADS_CONN_PASSWORD_NOT_SET, "ADS JDBC connection password was not set.",
null);
}
if (schema == null) {
throw new AdsException(AdsException.ADS_CONN_SCHEMA_NOT_SET, "ADS JDBC connection schema was not set.",
null);
}
Connection connection = null;
Statement statement = null;
ResultSet rs = null;
try {
Class.forName("com.mysql.jdbc.Driver");
String url = AdsUtil.prepareJdbcUrl(this.adsURL, this.schema, this.socketTimeout, this.suffix);
Properties connectionProps = new Properties();
connectionProps.put("user", userName);
connectionProps.put("password", password);
connection = DriverManager.getConnection(url, connectionProps);
statement = connection.createStatement();
// ads 表名、schema名不区分大小写, 提高用户易用性, 注意列顺序性
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());
LOG.info(String.format("检查列信息sql语句:%s", columnMetaSql));View on GitHub (pinned to 80ec23d5c5)
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.
Example fix
// before
{"parameter":{"url":"...","username":"u","password":"p"}}
// after
{"parameter":{"url":"...","username":"u","password":"p","schema":"my_schema"}} Defensive patterns
Strategy: validation
Validate before calling
if (config.getString("schema") == null) {
throw new IllegalStateException("adswriter 'schema' key is required");
} Type guard
boolean isSchemaSet(String s) { return s != null && !s.trim().isEmpty(); } Try / catch
try {
return helper.getTableInfo(table);
} catch (AdsException e) {
if (e.getCode() == AdsException.ADS_CONN_SCHEMA_NOT_SET) {
throw new IllegalStateException("job config: ADS 'schema' missing", e);
}
throw e;
} Prevention
- 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.
When it happens
Trigger: The adswriter parameter block lacks the 'schema' key, so AdsHelper.schema is null when metadata is requested.
Common situations: Users migrating from MySQL-style configs who omit schema; the ADS schema name differs from the database in the URL; key misspelled.
Related errors
AI-assisted analysis of alibaba/DataX@80ec23d5c5 (2026-08-14).
Data as JSON: /api/errors/4303ddfdfc8c36e4.
Report an issue: GitHub.