alibaba/DataX · error · AdsException

-102

-102

Error message

ADS JDBC connection password was not set.

What it means

Fourth guard in getTableInfo: a null password throws AdsException code -102 (ADS_CONN_PASSWORD_NOT_SET). The helper refuses to build JDBC connection properties without a password, even if the account has an empty one.

Source

Thrown at adswriter/src/main/java/com/alibaba/datax/plugin/writer/adswriter/load/AdsHelper.java:102

     * @throws com.alibaba.datax.plugin.writer.adswriter.AdsException
     */
    public TableInfo getTableInfo(String table) throws AdsException {

        if (table == null) {
            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);

View on GitHub (pinned to 80ec23d5c5)

Solutions

  1. Add the 'password' key with the ADS account password to the adswriter parameter block.
  2. If the account truly has an empty password, pass an empty string rather than omitting the key (null vs "" distinction).
  3. Check templating/variable substitution actually produced a value in the final job JSON.

Example fix

// before
{"parameter":{"url":"...","username":"u"}}
// after
{"parameter":{"url":"...","username":"u","password":"secret"}}
Defensive patterns

Strategy: validation

Validate before calling

if (config.getString("password") == null) {
    throw new IllegalStateException("adswriter 'password' key is required");
}

Type guard

boolean isPasswordSet(String p) { return p != null; } // empty string allowed, null not

Try / catch

try {
    return helper.getTableInfo(table);
} catch (AdsException e) {
    if (e.getCode() == AdsException.ADS_CONN_PASSWORD_NOT_SET) {
        throw new IllegalStateException("job config: ADS 'password' missing", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: adswriter parameter block has no 'password' key (or it is named differently), leaving AdsHelper.password null when getTableInfo runs.

Common situations: Password omitted from the job JSON, moved to a template variable that rendered empty, or key spelled 'pwd'/'pass'.

Related errors


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