apache/shardingsphere · error · SQLFeatureNotSupportedException
getRowId
Error message
getRowId
What it means
ROWID is a vendor-specific identifier type exposed through the JDBC RowId interface. ShardingSphere's in-memory federation ResultSet does not carry driver ROWIDs, so getRowId(int) is final and unconditionally throws SQLFeatureNotSupportedException.
Source
Thrown at kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.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 an explicit primary-key column instead of ROWID and use it for row addressing.
- Read the ROWID column as a String via getString(columnIndex) when the database renders it as a pseudo-column value.
- Disable federation for the affected statements so the native driver ResultSet (which supports getRowId) is returned.
- Adjust ORM dialect settings to stop emitting ROWID-based operations under ShardingSphere.
Example fix
// before RowId rowId = resultSet.getRowId(1); // after String id = resultSet.getString(1); // select the primary key instead of ROWID
Defensive patterns
Strategy: fallback
Validate before calling
if (resultSet.getMetaData().getColumnType(1) == Types.ROWID) { /* expect getString fallback under federation */ } Try / catch
try { RowId rid = rs.getRowId(1); } catch (SQLFeatureNotSupportedException e) { String rid = rs.getString(1); } Prevention
- Avoid ROWID-based addressing in applications that run over ShardingSphere.
- Always SELECT an explicit primary key alongside ROWID so a fallback identifier exists.
- Disable ROWID-oriented ORM dialect features when using federation.
When it happens
Trigger: Calling ResultSet.getRowId(int columnIndex) on a federation ResultSet — typically code that relies on Oracle/MySQL ROWID pseudo-columns for fast row addressing or optimistic locking.
Common situations: Oracle-oriented applications that SELECT ROWID or use WHERE ROWID = ?; ORM 'rowid' dialect features enabled against ShardingSphere; migration from a driver connection where getRowId worked to a federation-enabled datasource.
Related errors
AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14).
Data as JSON: /api/errors/313d970e53c25979.
Report an issue: GitHub.