apache/shardingsphere · error · SQLFeatureNotSupportedException
getRowId
Error message
getRowId
What it means
getRowId(int columnIndex) is final in AbstractUnsupportedOperationResultSet and throws SQLFeatureNotSupportedException. Although a row-id value could in principle pass through, the sharding driver does not expose RowId objects because row identity is shard-local and cannot be meaningfully used in positioned operations across the merged result.
Source
Thrown at jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationResultSet.java:185
@Override
public final Reader getNCharacterStream(final String columnLabel) throws SQLException {
throw new SQLFeatureNotSupportedException("getNCharacterStream");
}
@Override
public final Ref getRef(final int columnIndex) throws SQLException {
throw new SQLFeatureNotSupportedException("getRef");
}
@Override
public final Ref getRef(final String columnLabel) throws SQLException {
throw new SQLFeatureNotSupportedException("getRef");
}
@Override
public final RowId getRowId(final int columnIndex) throws SQLException {
throw new SQLFeatureNotSupportedException("getRowId");
}
@Override
public final RowId getRowId(final String columnLabel) throws SQLException {
throw new SQLFeatureNotSupportedException("getRowId");
}
@Override
public <T> T getObject(final int columnIndex, final Class<T> type) throws SQLException {
throw new SQLFeatureNotSupportedException("getObject with type");
}
@Override
public <T> T getObject(final String columnLabel, final Class<T> type) throws SQLException {
throw new SQLFeatureNotSupportedException("getObject with type");
}
@OverrideView on GitHub (pinned to e952770a21)
Solutions
- Select and use the table's primary key instead of ROWID for identifying rows, and update with WHERE pk = ?.
- Remove ROWID pseudo-columns from SELECT lists executed through the sharding datasource.
- If ROWID fast paths are essential for a maintenance job, run it against the physical datasource connection.
Example fix
// before
RowId rowId = rs.getRowId(1); // throws
ps.setRowId(1, rowId);
// after
long id = rs.getLong("id");
ps.setLong(1, id); // UPDATE ... WHERE id = ? Defensive patterns
Strategy: validation
Validate before calling
// include the PK in your SELECT and use it instead of ROWID
long id = rs.getLong("id"); Try / catch
try {
rowId = rs.getRowId(col);
} catch (SQLFeatureNotSupportedException e) {
id = rs.getLong("id"); // use primary key
} Prevention
- Remove ROWID pseudo-columns from SQL routed through ShardingSphere.
- Use primary keys for identity and concurrency checks.
- Keep ROWID fast paths on physical-datasource connections only.
When it happens
Trigger: Calling ResultSet.getRowId(columnIndex) on a sharding ResultSet — often mappers handling Types.ROWID (Oracle ROWID pseudo-column, MySQL's implicit rowid use) or code that uses RowId for later Statement/PreparedStatement row-id updates.
Common situations: Oracle ROWID-based fast-path updates ported behind the sharding layer; SELECT ROWID queries still present in SQL; ORM dialect code that fetches RowId for identity tracking.
Related errors
AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14).
Data as JSON: /api/errors/6b061bf321dd4ea5.
Report an issue: GitHub.