{"record":{"id":"c9bc84cb782d7ff3","repo":"apache/shardingsphere","slug":"getref-c9bc84","errorCode":null,"errorMessage":"getRef","messagePattern":"getRef","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java","lineNumber":175,"sourceCode":"    \n    @Override\n    public final NClob getNClob(final String columnLabel) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getNClob\");\n    }\n    \n    @Override\n    public final Reader getNCharacterStream(final int columnIndex) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getNCharacterStream\");\n    }\n    \n    @Override\n    public final Reader getNCharacterStream(final String columnLabel) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getNCharacterStream\");\n    }\n    \n    @Override\n    public final Ref getRef(final int columnIndex) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getRef\");\n    }\n    \n    @Override\n    public final Ref getRef(final String columnLabel) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getRef\");\n    }\n    \n    @Override\n    public final RowId getRowId(final int columnIndex) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getRowId\");\n    }\n    \n    @Override\n    public final RowId getRowId(final String columnLabel) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getRowId\");\n    }\n    \n    @Override","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java#L157-L193","documentation":"SQL REF types are a rarely implemented JDBC optional feature, and ShardingSphere's federation ResultSet does not support them. getRef(int) is final in AbstractUnsupportedOperationSQLFederationResultSet and always throws SQLFeatureNotSupportedException, since federated results are flattened values with no server-side reference semantics.","triggerScenarios":"Calling ResultSet.getRef(int columnIndex) on a ResultSet returned by a SQL federation query, i.e. any attempt to read a SQL REF-typed column by index through the federation engine.","commonSituations":"Generic JDBC tooling or migration utilities that call getRef on every column of a known REF type; schemas with SQL:1999 REF columns (mostly Oracle-style object-relational usage) queried through ShardingSphere federation.","solutions":["Avoid REF access under federation: restructure the schema to use ordinary foreign-key joins instead of SQL REF types.","Read the underlying value with getObject/getString if the driver materializes references as addressable values, then resolve manually.","Route such statements outside federation to the backing driver, whose ResultSet may implement getRef.","Catch SQLFeatureNotSupportedException and degrade gracefully if the column is optional."],"exampleFix":"// before\nRef ref = resultSet.getRef(1);\n\n// after\nObject value = resultSet.getObject(1); // resolve the reference manually","handlingStrategy":"try-catch","validationCode":"// check column type before attempting REF access\nif (resultSet.getMetaData().getColumnType(1) != Types.REF) { /* safe path */ }","typeGuard":null,"tryCatchPattern":"try { Ref ref = rs.getRef(1); } catch (SQLFeatureNotSupportedException e) { log.warn(\"REF access unsupported under federation; column={}\", 1); }","preventionTips":["Model references as foreign keys rather than SQL REF types in sharded schemas.","Probe database capabilities with a federation-mode integration test at startup for exotic types.","Avoid generic 'read every column by its JDBC type' utilities against federation results."],"tags":["jdbc","sql-federation","resultset","unsupported-operation","ref-type"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}