apache/shardingsphere · error · SQLFeatureNotSupportedException

updateRowId

Error message

updateRowId

What it means

updateRowId(int, RowId) throws SQLFeatureNotSupportedException on federation ResultSets. RowId updates are a driver-optional JDBC feature tied to a live updatable cursor against a physical row; a federation result is a merged in-memory projection, so ShardingSphere rejects the whole family explicitly.

Source

Thrown at kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedUpdateOperationSQLFederationResultSet.java:434

    
    @Override
    public final void updateNClob(final String columnLabel, final Reader reader, final long length) throws SQLException {
        throw new SQLFeatureNotSupportedException("updateNClob");
    }
    
    @Override
    public final void updateArray(final int columnIndex, final Array x) throws SQLException {
        throw new SQLFeatureNotSupportedException("updateArray");
    }
    
    @Override
    public final void updateArray(final String columnLabel, final Array x) throws SQLException {
        throw new SQLFeatureNotSupportedException("updateArray");
    }
    
    @Override
    public final void updateRowId(final int columnIndex, final RowId x) throws SQLException {
        throw new SQLFeatureNotSupportedException("updateRowId");
    }
    
    @Override
    public final void updateRowId(final String columnLabel, final RowId x) throws SQLException {
        throw new SQLFeatureNotSupportedException("updateRowId");
    }
    
    @Override
    public final void updateSQLXML(final int columnIndex, final SQLXML xmlObject) throws SQLException {
        throw new SQLFeatureNotSupportedException("updateSQLXML");
    }
    
    @Override
    public final void updateSQLXML(final String columnLabel, final SQLXML xmlObject) throws SQLException {
        throw new SQLFeatureNotSupportedException("updateSQLXML");
    }
}

View on GitHub (pinned to e952770a21)

Solutions

  1. Replace RowId cursor updates with primary-key based UPDATE statements.
  2. Rewrite or re-route the query so it does not go through the federation engine.
  3. Map ROWID access to the physical table's primary key in your data model behind the proxy.
  4. Catch SQLFeatureNotSupportedException in generic flush code and fall back to keyed UPDATE.

Example fix

// before
RowId rid = rs.getRowId(1);
// ... later on a federated rs
rs.updateRowId(1, rid);
rs.updateRow();

// after
long id = rs.getLong("id");
try (PreparedStatement ps = conn.prepareStatement("UPDATE t SET val = ? WHERE id = ?")) {
    ps.setString(1, val);
    ps.setLong(2, id);
    ps.executeUpdate();
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (rs.getConcurrency() != ResultSet.CONCUR_UPDATABLE) { throw new IllegalStateException("ResultSet is not updatable; use UPDATE statement"); }

Try / catch

try { rs.updateRowId(1, rid); } catch (final SQLFeatureNotSupportedException ex) { /* primary-key UPDATE fallback */ }

Prevention

When it happens

Trigger: Calling rs.updateRowId(columnIndex, rowId) on the ResultSet of a federated query — typically code copied from Oracle usage where ROWID-based in-place updates are idiomatic.

Common situations: Oracle-oriented code paths that grab rs.getRowId() and later updateRowId(); generic ORM update flush logic that handles RowId columns; migration of legacy Oracle batch tools behind ShardingSphere.

Related errors


AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14). Data as JSON: /api/errors/b42653e1aaf51544. Report an issue: GitHub.