{"record":{"id":"b26a7e7921a26aab","repo":"apache/shardingsphere","slug":"createnclob","errorCode":null,"errorMessage":"createNClob","messagePattern":"createNClob","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationConnection.java","lineNumber":104,"sourceCode":"    \n    @Override\n    public Array createArrayOf(final String typeName, final Object[] elements) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"createArrayOf\");\n    }\n    \n    @Override\n    public final Blob createBlob() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"createBlob\");\n    }\n    \n    @Override\n    public Clob createClob() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"createClob\");\n    }\n    \n    @Override\n    public final NClob createNClob() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"createNClob\");\n    }\n    \n    @Override\n    public final SQLXML createSQLXML() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"createSQLXML\");\n    }\n    \n    @Override\n    public final Struct createStruct(final String typeName, final Object[] attributes) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"createStruct\");\n    }\n    \n    @Override\n    public final Properties getClientInfo() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getClientInfo\");\n    }\n    \n    @Override","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationConnection.java#L86-L122","documentation":"ShardingSphere's JDBC driver does not implement the java.sql.Connection method createNClob (creating an empty java.sql.NClob for national-character (NCHAR/NVARCHAR/NCLOB) data). The abstract base class AbstractUnsupportedOperationConnection, which ShardingSphereConnection extends, overrides it as final and unconditionally throws SQLFeatureNotSupportedException. ShardingSphere does not implement client-side LOB factories, and NCLOB support is not part of its feature matrix, so the method always throws. The exception is thrown the moment the method is invoked on any connection produced by the ShardingSphere Driver.","triggerScenarios":"Calling Connection.createNClob() on a ShardingSphere connection.","commonSituations":"Code written against drivers with full JDBC 4 national-character support (Oracle, SQL Server); ORM nationalized-character mappings (Hibernate @Nationalized); frameworks that probe NClob capability.","solutions":["Use setNString(int, String) or setNCharacterStream(int, Reader, long) on the PreparedStatement instead of an NClob object.","If the backend column is a plain CLOB/VARCHAR, use setString/setClob(Reader) and drop national-character typing.","For genuine NCLOB columns on Oracle/SQL Server backends, unwrap the native connection to create the NClob and verify the routed statement afterwards."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"boolean supportsOp = false;\ntry {\n    connection.getMetaData(); // connection is alive\n    // JDBC has no capability flag for individual methods; probe once per JVM:\n    supportsOp = probeSupport(connection); // reflective/one-time guarded call\n} catch (final SQLException ignored) {\n}\n// Simpler and recommended: capability-check by driver URL\nboolean isShardingSphere = url.startsWith(\"jdbc:shardingsphere:\");\nif (isShardingSphere) {\n    // skip the unsupported call, use the alternative API path\n}","typeGuard":null,"tryCatchPattern":"try {\n    connection.createNClob(/* args */);\n} catch (final SQLFeatureNotSupportedException e) {\n    // expected on ShardingSphere connections: fall back to supported API\n    log.debug(\"Driver does not support createNClob, using fallback\", e);\n}","preventionTips":["Use setNString/setNCharacterStream instead of NClob objects for national-character columns.","Check the JDBC URL before calling optional JDBC 4 methods: connections starting with jdbc:shardingsphere: never support the lob/network-timeout/client-info/callable APIs.","Catch java.sql.SQLFeatureNotSupportedException (parent of ShardingSphere's UnsupportedSQLOperationException) around optional driver-capability calls so the application degrades gracefully."],"tags":["jdbc","shardingsphere","unsupported-operation","connection-api"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}