{"record":{"id":"cb026fed90f57c51","repo":"apache/shardingsphere","slug":"getnclob-cb026f","errorCode":null,"errorMessage":"getNClob","messagePattern":"getNClob","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java","lineNumber":155,"sourceCode":"    \n    @Override\n    public final boolean rowDeleted() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"rowDeleted\");\n    }\n    \n    @Override\n    public final String getCursorName() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getCursorName\");\n    }\n    \n    @Override\n    public final int getHoldability() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getHoldability\");\n    }\n    \n    @Override\n    public final NClob getNClob(final int columnIndex) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getNClob\");\n    }\n    \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","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java#L137-L173","documentation":"getNClob(int columnIndex) throws SQLFeatureNotSupportedException in the SQL Federation ResultSet (by column index). NCHAR/NVARCHAR/NCLOB nationals-character types are not part of the federation result decoding path, so the accessor is deliberately stubbed out as unsupported rather than returning a value or null.","triggerScenarios":"Calling rs.getNClob(1) (any column index) on a federated SELECT that returns national-character data — e.g. reading NTEXT/NVARCHAR columns of a SQL Server or Oracle table through a cross-shard federated query.","commonSituations":"Reading NCLOB/NTEXT columns of migrated SQL Server/Oracle schemas through ShardingSphere federation; ORM national-character type handlers (Hibernate NClobType) mapped to entity fields; column type changed to NVARCHAR/NCHAR after the app already ran under federation, surfacing the gap only for the affected column.","solutions":["Use getString(columnIndex) (or getClob + charset handling) for national-character columns; most backends deliver NVARCHAR as String through federation","If a real java.sql.NClob object is required by an API, convert: conn.createNClob() then set the value from getString()","Alter the column type to VARCHAR/CLOB if national-character semantics are not actually needed","Verify the column truly must come from the federated path; querying the shard directly preserves native driver NClob support"],"exampleFix":"// before\nNClob n = rs.getNClob(1);\n\n// after\nString value = rs.getString(1);","handlingStrategy":"validation","validationCode":"// National-character columns arrive as String through federation: prefer getString()\n// Guard only if you must produce an NClob:\ntry { rs.getNClob(1); }\ncatch (final SQLFeatureNotSupportedException e) { /* fall back to getString(1) */ }","typeGuard":"private String readNationalColumn(final ResultSet rs, final int idx) throws SQLException {\n    try { return rs.getNClob(idx).getSubString(1, (int) rs.getNClob(idx).length()); }\n    catch (final SQLFeatureNotSupportedException e) { return rs.getString(idx); }\n}","tryCatchPattern":"NClob clob;\ntry { clob = rs.getNClob(1); }\ncatch (final SQLFeatureNotSupportedException e) { clob = toNclob(conn, rs.getString(1)); }","preventionTips":["Map NVARCHAR/NTEXT entity fields to String when reads go through federation","Convert to NClob at the boundary only if an API demands the type","Add NCLOB accessors to the federation incompatibility checklist"],"tags":["jdbc","resultset","sql-federation","nclob","nvarchar","shardingsphere"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}