{"record":{"id":"e301f44fab588d7c","repo":"prestodb/presto","slug":"setncharacterstream","errorCode":null,"errorMessage":"setNCharacterStream","messagePattern":"setNCharacterStream","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"warning","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoPreparedStatement.java","lineNumber":582,"sourceCode":"    @Override\n    public void setRowId(int parameterIndex, RowId x)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"setRowId\");\n    }\n\n    @Override\n    public void setNString(int parameterIndex, String value)\n            throws SQLException\n    {\n        setString(parameterIndex, value);\n    }\n\n    @Override\n    public void setNCharacterStream(int parameterIndex, Reader value, long length)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"setNCharacterStream\");\n    }\n\n    @Override\n    public void setNClob(int parameterIndex, NClob value)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"setNClob\");\n    }\n\n    @Override\n    public void setClob(int parameterIndex, Reader reader, long length)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"setClob\");\n    }\n\n    @Override\n    public void setBlob(int parameterIndex, InputStream inputStream, long length)","sourceCodeStart":564,"sourceCodeEnd":600,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoPreparedStatement.java#L564-L600","documentation":"PrestoPreparedStatement.setNCharacterStream is a stub throwing SQLFeatureNotSupportedException. The driver does not support the JDBC national-character-stream APIs used for NCHAR/NVARCHAR streaming input. Presto strings are UTF-8, so the national-character variants are unnecessary and unimplemented.","triggerScenarios":"Calling PreparedStatement.setNCharacterStream(int, Reader, long) on a PrestoPreparedStatement; drivers/generic code paths that choose setNCharacterStream when the target is an NCHAR/NVARCHAR/LONGNVARCHAR column.","commonSituations":"Code written for SQL Server or Oracle national character columns reused against Presto; ORM mappings that stream large text via setNCharacterStream.","solutions":["Use setCharacterStream(int, Reader, long) instead of the N-variant","Read the Reader into a String and bind with setString for smaller values","Normalize the mapping layer so Presto VARCHAR columns map to standard setString/setCharacterStream"],"exampleFix":"// before\npstmt.setNCharacterStream(1, reader, length);\n// after\npstmt.setCharacterStream(1, reader, length);","handlingStrategy":"fallback","validationCode":"if (targetType == Types.NCHAR || targetType == Types.NVARCHAR || targetType == Types.LONGNVARCHAR) { targetType = Types.VARCHAR; } // normalize before choosing setter","typeGuard":"boolean isNationalCharType(int sqlType) { return sqlType == Types.NCHAR || sqlType == Types.NVARCHAR || sqlType == Types.LONGNVARCHAR; }","tryCatchPattern":"try { pstmt.setNCharacterStream(idx, reader, len); } catch (SQLFeatureNotSupportedException e) { pstmt.setCharacterStream(idx, reader, len); }","preventionTips":["Normalize NCHAR/NVARCHAR targets to VARCHAR for Presto","Route all stream binding through setCharacterStream","Avoid drivers/ORM dialects that auto-select N-variant setters"],"tags":["jdbc","unsupported-feature","stream"],"backgroundTag":"sqlfeaturenotsupported","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}