apache/shardingsphere · error · SQLFeatureNotSupportedException
updateRow
Error message
updateRow
What it means
updateRow() is not supported: the federation ResultSet is a read-only view of federation engine output, and AbstractUnsupportedOperationSQLFederationResultSet marks updateRow() final and throws SQLFeatureNotSupportedException for any attempt to flush row edits through the ResultSet cursor API.
Source
Thrown at kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java:100
@Override
public boolean relative(final int rows) throws SQLException {
throw new SQLFeatureNotSupportedException("relative");
}
@Override
public int getRow() throws SQLException {
throw new SQLFeatureNotSupportedException("getRow");
}
@Override
public final void insertRow() throws SQLException {
throw new SQLFeatureNotSupportedException("insertRow");
}
@Override
public final void updateRow() throws SQLException {
throw new SQLFeatureNotSupportedException("updateRow");
}
@Override
public final void deleteRow() throws SQLException {
throw new SQLFeatureNotSupportedException("deleteRow");
}
@Override
public final void refreshRow() throws SQLException {
throw new SQLFeatureNotSupportedException("refreshRow");
}
@Override
public final void cancelRowUpdates() throws SQLException {
throw new SQLFeatureNotSupportedException("cancelRowUpdates");
}
@OverrideView on GitHub (pinned to e952770a21)
Solutions
- Replace ResultSet-based edits with explicit UPDATE ... WHERE key = ? PreparedStatements on the same connection
- Disable updatable-result-set editing in the client tool/ORM for federation datasources
- Confirm the affected SELECT actually needs federation; if not, exclude it so it returns a driver-managed updatable ResultSet from the real database
Example fix
// before
rs.updateString("name", "new");
rs.updateRow();
// after
try (PreparedStatement ps = conn.prepareStatement("UPDATE t SET name = ? WHERE id = ?")) {
ps.setString(1, "new");
ps.setLong(2, id);
ps.executeUpdate();
} Defensive patterns
Strategy: try-catch
Validate before calling
if (rs.getConcurrency() == ResultSet.CONCUR_READ_ONLY) {
// updateRow() unsupported: issue keyed UPDATE statements
} Type guard
private boolean isUpdatable(final ResultSet rs) throws SQLException {
return rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE;
} Try / catch
try {
rs.updateRow();
} catch (final SQLFeatureNotSupportedException e) {
executeKeyedUpdate(conn, tableName, changes, id);
} Prevention
- Convert cursor edits to keyed UPDATE statements
- Disable inline editing in DB tools for federation connections
- Check rs.getConcurrency() before any updateXXX/updateRow flow
When it happens
Trigger: Calling rs.updateRow() after updateXXX() calls on a federated ResultSet — the final step of the JDBC updatable-result-set edit pattern — against a ShardingSphere federation statement.
Common situations: Grid/table UI editors that commit cell edits via updateRow(); applications written for updatable cursors on a single-node database later pointed at ShardingSphere with federation enabled; accidental UPDATE-via-ResultSet on a query that federation rewrote (e.g. a cross-shard SELECT with computed columns).
Related errors
AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14).
Data as JSON: /api/errors/4549d4fdd5f27532.
Report an issue: GitHub.