alibaba/DataX · error · AdsException

-101

-101

Error message

ADS JDBC connection user name was not set.

What it means

Third guard in getTableInfo: a null userName on AdsHelper throws AdsException code -101 (ADS_CONN_USERNAME_NOT_SET) before any JDBC work. The ADS account used for metadata lookup was not provided.

Source

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

    /**
     * Obtain the table meta information.
     * 
     * @param table The table
     * @return The table meta information
     * @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");

View on GitHub (pinned to 80ec23d5c5)

Solutions

  1. Add 'username' with the ADS account name to the adswriter parameter block.
  2. Confirm spelling is username, not user, for this plugin.
  3. Verify no leading/trailing whitespace that could make the value effectively blank.

Example fix

// before
{"parameter":{"url":"...","table":"t"}}
// after
{"parameter":{"url":"...","table":"t","username":"ads_user"}}
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

boolean isUsernameSet(String u) { return u != null && !u.trim().isEmpty(); }

Try / catch

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

Prevention

When it happens

Trigger: getTableInfo called when the writer config lacks the 'username' key, so AdsHelper.userName stays null.

Common situations: Missing username in the adswriter parameter block, or key spelled 'user' (the RDS/MySQL convention) instead of 'username'.

Related errors


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