{"record":{"id":"2c41c834a223bb57","repo":"apache/shardingsphere","slug":"setnclob","errorCode":null,"errorMessage":"setNClob","messagePattern":"setNClob","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationPreparedStatement.java","lineNumber":54,"sourceCode":"    \n    @Override\n    public final void addBatch(final String sql) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"addBatch sql in PreparedStatement\");\n    }\n    \n    @Override\n    public final ResultSetMetaData getMetaData() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getMetaData\");\n    }\n    \n    @Override\n    public final void setNString(final int parameterIndex, final String x) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"setNString\");\n    }\n    \n    @Override\n    public final void setNClob(final int parameterIndex, final NClob x) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"setNClob\");\n    }\n    \n    @Override\n    public final void setNClob(final int parameterIndex, final Reader x) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"setNClob\");\n    }\n    \n    @Override\n    public final void setNClob(final int parameterIndex, final Reader x, final long length) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"setNClob\");\n    }\n    \n    @Override\n    public final void setNCharacterStream(final int parameterIndex, final Reader x) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"setNCharacterStream\");\n    }\n    \n    @Override","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationPreparedStatement.java#L36-L72","documentation":"SQLFeatureNotSupportedException('setNClob') thrown by AbstractUnsupportedOperationPreparedStatement.setNClob(int, NClob). National-character LOB binding is unsupported: ShardingSphere's driver never materializes backend LOB handles at prepare time, so all NClob overloads are final and throw.","triggerScenarios":"ps.setNClob(1, nclob) on a ShardingSphere PreparedStatement; appears when porting Oracle/SQLServer NCLOB handling or when a generic binder dispatches on the value being an NClob instance.","commonSituations":"Large Unicode text columns (NCLOB) mapped to java.sql.NClob in entity code; ORM type handlers for nationalized CLOBs; code copied from a driver-agnostic tutorial.","solutions":["Use setCharacterStream(1, new StringReader(text)) or setString for NCLOB-sized values on ShardingSphere.","If an NClob object is unavoidable, read it (nclob.getCharacterStream()) and bind the Reader via setCharacterStream.","Store nationalized text as ordinary CLOB/TEXT with a Unicode encoding and drop the N-type mapping."],"exampleFix":"// before\nps.setNClob(1, nclob);\n\n// after\nps.setCharacterStream(1, nclob.getCharacterStream(), nclob.length());","handlingStrategy":"fallback","validationCode":"if (value instanceof NClob) { NClob n = (NClob) value; ps.setCharacterStream(idx, n.getCharacterStream(), n.length()); } else { ps.setClob(idx, (Clob) value); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Bind Readers via setCharacterStream, not setNClob","Avoid java.sql.NClob in entity mappings","Map NCLOB columns to String with a Unicode-capable dialect"],"tags":["jdbc","shardingsphere","preparedstatement","nclob","sql-feature-not-supported"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}