apache/shardingsphere · error · SQLFeatureNotSupportedException
updateDouble
Error message
updateDouble
What it means
The SQL federation engine in ShardingSphere computes query results in memory and exposes them through a ResultSet whose update methods are all stubbed to throw SQLFeatureNotSupportedException in AbstractUnsupportedUpdateOperationSQLFederationResultSet. 'updateDouble' is the message for the columnIndex overload of the double updater. The design guarantees fail-fast behavior for any attempt to mutate rows through a federated cursor.
Source
Thrown at kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedUpdateOperationSQLFederationResultSet.java:114
@Override
public final void updateLong(final String columnLabel, final long x) throws SQLException {
throw new SQLFeatureNotSupportedException("updateLong");
}
@Override
public final void updateFloat(final int columnIndex, final float x) throws SQLException {
throw new SQLFeatureNotSupportedException("updateFloat");
}
@Override
public final void updateFloat(final String columnLabel, final float x) throws SQLException {
throw new SQLFeatureNotSupportedException("updateFloat");
}
@Override
public final void updateDouble(final int columnIndex, final double x) throws SQLException {
throw new SQLFeatureNotSupportedException("updateDouble");
}
@Override
public final void updateDouble(final String columnLabel, final double x) throws SQLException {
throw new SQLFeatureNotSupportedException("updateDouble");
}
@Override
public final void updateBigDecimal(final int columnIndex, final BigDecimal x) throws SQLException {
throw new SQLFeatureNotSupportedException("updateBigDecimal");
}
@Override
public final void updateBigDecimal(final String columnLabel, final BigDecimal x) throws SQLException {
throw new SQLFeatureNotSupportedException("updateBigDecimal");
}
@OverrideView on GitHub (pinned to e952770a21)
Solutions
- Read with getDouble(columnIndex) and persist changes via a PreparedStatement UPDATE keyed on the primary key.
- Before any cursor-update branch, test rs.getConcurrency(); treat CONCUR_READ_ONLY as 'use UPDATE statements'.
- Exclude this statement from sql_federation (scope the rule or disable sqlFederation) so the native driver ResultSet with its own concurrency is returned.
Example fix
// before
rs.updateDouble(3, 19.99); // SQLFeatureNotSupportedException: updateDouble
rs.updateRow();
// after
try (PreparedStatement upd = conn.prepareStatement("UPDATE products SET price = ? WHERE id = ?")) {
upd.setDouble(1, 19.99);
upd.setLong(2, rs.getLong(1));
upd.executeUpdate();
} Defensive patterns
Strategy: try-catch
Validate before calling
if (rs.getConcurrency() != ResultSet.CONCUR_UPDATABLE) {
// use an UPDATE statement instead of rs.updateDouble(...)
} Type guard
private static boolean supportsRowUpdates(final ResultSet rs) throws SQLException {
return rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE;
} Try / catch
try {
rs.updateDouble(3, price);
} catch (final SQLFeatureNotSupportedException ignored) {
try (PreparedStatement upd = conn.prepareStatement("UPDATE products SET price = ? WHERE id = ?")) {
upd.setDouble(1, price);
upd.setLong(2, rs.getLong(1));
upd.executeUpdate();
}
} Prevention
- Assume federation result sets are read-only and write via UPDATE statements.
- Test edit flows against a sqlFederation-enabled datasource before shipping.
- Check rs.getConcurrency() in shared JDBC utilities before calling any updateXxx method.
When it happens
Trigger: Calling ResultSet.updateDouble(int columnIndex, double x) while iterating a federation ResultSet (query matched by an enabled sql_federation rule, e.g. cross-shard aggregation or join). Happens with updatable-grid widgets or hand-rolled row patching that assume CONCUR_UPDATABLE semantics.
Common situations: Porting desktop/report tooling that edits cells via updateDouble to a ShardingSphere federated datasource; enabling sqlFederation in YAML and re-running existing batch jobs that patch rows in place; integration tests exercising updateRow flows against federation results.
Related errors
AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14).
Data as JSON: /api/errors/855739964ec6afa7.
Report an issue: GitHub.