{"record":{"id":"dbb7d545b3ebd945","repo":"apache/shardingsphere","slug":"getnclob","errorCode":null,"errorMessage":"getNClob","messagePattern":"getNClob","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationResultSet.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/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationResultSet.java#L137-L173","documentation":"getNClob(int columnIndex) is final in AbstractUnsupportedOperationResultSet and throws SQLFeatureNotSupportedException. The sharding driver does not materialize NCHAR/NVARCHAR/NCLOB columns as java.sql.NClob objects in its merged ResultSet, so the N-specific accessor is disabled by design.","triggerScenarios":"Calling ResultSet.getNClob(columnIndex) on a ResultSet from ShardingSphereDataSource — typically generic row-mapper code that switches on java.sql.Types.NCLOB, or copied vendor sample code for national-character columns.","commonSituations":"Row mappers that branch on JDBC column type to pick getNClob; migration from MySQL/Oracle drivers that return NClob for national character columns; ORM dialect code that prefers NClob accessors.","solutions":["Fetch the value as String or Clob: getString(columnIndex) or getClob(columnIndex), and convert as needed; for large data use getCharacterStream and wrap it.","If an NClob instance is required, create one via connection.createNClob() and copy the characters.","Adjust row-mapper type switches to map NCLOB to String/Clob handling when running under ShardingSphere."],"exampleFix":"// before\nNClob nclob = rs.getNClob(2); // throws\n\n// after\nString value = rs.getString(2);\n// or stream: Reader r = rs.getNCharacterStream-like via rs.getCharacterStream(2)","handlingStrategy":"type-guard","validationCode":"// check the column really is NCLOB, then use String/Clob path anyway\nint type = rs.getMetaData().getColumnType(col);\nif (type == Types.NCLOB || type == Types.NVARCHAR) { value = rs.getString(col); }","typeGuard":"boolean nValueViaString(ResultSetMetaData md, int col) throws SQLException {\n    int t = md.getColumnType(col);\n    return t == Types.NCLOB || t == Types.NVARCHAR || t == Types.NCHAR;\n    // always true: use getString/getCharacterStream under this driver\n}","tryCatchPattern":"try {\n    nclob = rs.getNClob(col);\n} catch (SQLFeatureNotSupportedException e) {\n    nclob = null;\n    value = rs.getString(col);\n}","preventionTips":["Use getString/getCharacterStream for all national-character columns.","Standardize row mappers on non-N accessors when ShardingSphere is in play.","Avoid returning NClob objects from your data-access layer."],"tags":["jdbc","resultset","nclob","nchar","shardingsphere","unsupported-operation"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}