apache/shardingsphere · error · SQLFeatureNotSupportedException

getHoldability

Error message

getHoldability

What it means

getHoldability() is final in AbstractUnsupportedOperationResultSet and always throws SQLFeatureNotSupportedException. The sharding ResultSet abstracts over multiple physical ResultSets from different connections, each potentially with its own holdability, so a single value cannot be reported.

Source

Thrown at jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationResultSet.java:150

    
    @Override
    public final boolean rowUpdated() throws SQLException {
        throw new SQLFeatureNotSupportedException("rowUpdated");
    }
    
    @Override
    public final boolean rowDeleted() throws SQLException {
        throw new SQLFeatureNotSupportedException("rowDeleted");
    }
    
    @Override
    public final String getCursorName() throws SQLException {
        throw new SQLFeatureNotSupportedException("getCursorName");
    }
    
    @Override
    public final int getHoldability() throws SQLException {
        throw new SQLFeatureNotSupportedException("getHoldability");
    }
    
    @Override
    public final NClob getNClob(final int columnIndex) throws SQLException {
        throw new SQLFeatureNotSupportedException("getNClob");
    }
    
    @Override
    public final NClob getNClob(final String columnLabel) throws SQLException {
        throw new SQLFeatureNotSupportedException("getNClob");
    }
    
    @Override
    public final Reader getNCharacterStream(final int columnIndex) throws SQLException {
        throw new SQLFeatureNotSupportedException("getNCharacterStream");
    }
    
    @Override

View on GitHub (pinned to e952770a21)

Solutions

  1. Read holdability from the underlying objects instead: Connection.getHoldability() or Statement instance metadata, or query the physical datasource connection.
  2. Remove the call if it was only informational probing; hard-code the behavior your flow needs (close ResultSets before commit).
  3. Wrap the call in a try/catch for SQLFeatureNotSupportedException during generic introspection.

Example fix

// before
int hold = rs.getHoldability(); // throws

// after
int hold = conn.getHoldability(); // from the ShardingSphere Connection, or the physical connection
Defensive patterns

Strategy: try-catch

Validate before calling

int holdability = conn.getHoldability(); // ask the Connection, not the ResultSet

Try / catch

try {
    int h = rs.getHoldability();
} catch (SQLFeatureNotSupportedException e) {
    h = conn.getHoldability();
}

Prevention

When it happens

Trigger: Calling ResultSet.getHoldability() on a ResultSet from ShardingSphereDataSource — usually via generic JDBC metadata crawlers, ORM bootstrap code that inspects result-set capabilities, or code deciding commit behavior for held cursors.

Common situations: Framework capability checks that enumerate all ResultSet methods; migration from a plain driver where getHoldability returned Connection.HOLD_CURSORS_OVER_COMMIT; tooling that assumes holdability when mixing commits with open ResultSets.

Related errors


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