t8y2/dbx · error · IllegalArgumentException

Table not found: {schema}.{table}

Error message

Table not found: {schema}.{table}

What it means

DamengAgent.getDDL could not find any DDL for the requested schema.table. The metadata queries (including table, columns, and dependent objects) returned no rows, so instead of returning null/empty DDL the agent throws IllegalArgumentException. This indicates the table does not exist under that schema, or the caller lacks privileges to see its metadata.

Source

Thrown at agents/drivers/dameng/src/main/java/com/dbx/agent/dameng/DamengAgent.java:1680

        try {
            return unchecked(() -> {
                String sql = "SELECT /*+ PARALLEL(1) */ DBMS_METADATA.GET_DDL(?, ?, ?) FROM DUAL";
                String ddl = null;
                try (PreparedStatement stmt = requireConnected().prepareStatement(sql)) {
                    stmt.setString(1, "TABLE");
                    stmt.setString(2, table);
                    stmt.setString(3, schema);
                    try (ResultSet rs = stmt.executeQuery()) {
                        if (rs.next()) {
                            ddl = coalesce(readTextColumn(rs, 1));
                        }
                    }
                }
                if (ddl != null) {
                    ddl = appendTableAndColumnComments(ddl, schema, table);
                    return appendIndependentIndexDdl(ddl, schema, table);
                }
                throw new IllegalArgumentException("Table not found: " + schema + "." + table);
            });
        } catch (RuntimeException error) {
            if (!isDamengMetadataUnavailableError(error)) {
                throw error;
            }
            try {
                return super.getTableDdl(schema, table);
            } catch (RuntimeException fallbackError) {
                fallbackError.addSuppressed(error);
                throw fallbackError;
            }
        }
    }

    @Override
    public List<ColumnInfo> getColumns(String schema, String table) {
        if (legacyJdbcMetadata) {
            return StandardJdbcMetadata.INSTANCE.getColumns(

View on GitHub (pinned to c0390bff16)

Solutions

  1. Verify the table exists: SELECT * FROM ALL_TABLES / SYSTABLES WHERE TABLE_NAME = '<TABLE>' in the target schema.
  2. Check schema and table casing — pass the identifier exactly as stored (usually uppercase) in Dameng.
  3. Grant the connecting user SELECT/VIEW privileges on the table and system catalog views.
  4. Confirm you are connected to the correct Dameng instance/database.

Example fix

// before
String ddl = agent.getDdl(conn, "myschema", "mytable");
// after
String ddl = agent.getDdl(conn, "MYSCHEMA", "MYTABLE"); // identifiers upper-cased, existence verified first
Defensive patterns

Strategy: validation

Validate before calling

// Java (caller side)
if (schema == null || schema.isBlank() || table == null || table.isBlank())
    throw new IllegalArgumentException("schema/table required");
try (var rs = conn.createStatement().executeQuery(
        "SELECT COUNT(*) FROM SYSCATALOG.SYSTABLES T " +
        "WHERE T.TABLE_NAME='" + table.toUpperCase() + "'")) {
    if (!rs.next() || rs.getInt(1) == 0)
        throw new IllegalArgumentException("Table does not exist: " + schema + "." + table);
}
String ddl = agent.getDdl(conn, schema.toUpperCase(), table.toUpperCase());

Try / catch

try {
    ddl = agent.getDdl(conn, schema, table);
} catch (IllegalArgumentException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("Table not found")) {
        LOG.warn("Skipping missing table {}.{}: {}", schema, table, e.getMessage());
        ddl = null; // or use Optional.empty()
    } else { throw e; }
}

Prevention

When it happens

Trigger: Calling the agent's DDL/source lookup (e.g. getDdl or source) with a schema/table combination for which the Dameng system metadata queries return no rows; ddl == null after the lookup, with the error not classified as a Dameng metadata-unavailable error.

Common situations: Typo in table or schema name; wrong case (Dameng stores identifiers uppercase by default); connecting as a user without SELECT privileges on the table or its metadata; querying a table in a different database or after it was dropped.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/8e0e09796280b550. Report an issue: GitHub.