{"record":{"id":"46f71a0b78caa60d","repo":"prestodb/presto","slug":"not-implemented-preparedstatement-setcharacterstr","errorCode":null,"errorMessage":"Not implemented: PreparedStatement.setCharacterStream","messagePattern":"Not implemented: PreparedStatement\\.setCharacterStream","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoPreparedStatement.java","lineNumber":482,"sourceCode":"                    batchUpdateCounts[i] = getUpdateCount();\n                }\n                catch (SQLException e) {\n                    long[] updateCounts = Arrays.stream(batchUpdateCounts).mapToLong(j -> j).toArray();\n                    throw new BatchUpdateException(e.getMessage(), e.getSQLState(), e.getErrorCode(), updateCounts, e.getCause());\n                }\n            }\n            return batchUpdateCounts;\n        }\n        finally {\n            clearBatch();\n        }\n    }\n\n    @Override\n    public void setCharacterStream(int parameterIndex, Reader reader, int length)\n            throws SQLException\n    {\n        throw new NotImplementedException(\"PreparedStatement\", \"setCharacterStream\");\n    }\n\n    @Override\n    public void setRef(int parameterIndex, Ref x)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"setRef\");\n    }\n\n    @Override\n    public void setBlob(int parameterIndex, Blob x)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"setBlob\");\n    }\n\n    @Override\n    public void setClob(int parameterIndex, Clob x)","sourceCodeStart":464,"sourceCodeEnd":500,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoPreparedStatement.java#L464-L500","documentation":"Presto's JDBC driver does not implement setCharacterStream; the method unconditionally throws NotImplementedException. Character stream parameters are not supported by the wire protocol mapping in this driver.","triggerScenarios":"Calling PreparedStatement.setCharacterStream(int, Reader, int) (or its overloads) on a Presto connection.","commonSituations":"Porting legacy JDBC code written for MySQL/Oracle drivers that streams large text into CLOB/text columns.","solutions":["Read the Reader into a String and call setString instead.","If the text is large, chunk it and build the value before binding.","Do not attempt to pass Reader/InputStream directly to Presto JDBC."],"exampleFix":"// before\nps.setCharacterStream(1, reader, length);\n// after\nString text = new BufferedReader(reader).lines().collect(Collectors.joining(\"\\n\"));\nps.setString(1, text);","handlingStrategy":"fallback","validationCode":"if (value instanceof Reader) { /* do not call setCharacterStream on Presto; read to String */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never use stream-based setters (setCharacterStream/setAsciiStream/setUnicodeStream) with Presto JDBC","Materialize Reader content into a String and use setString","Wrap driver-specific setters behind a data-access layer so unsupported ones fail fast in tests"],"tags":["jdbc","presto","unimplemented"],"backgroundTag":"jdbc-feature-not-implemented","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"}