{"record":{"id":"b364388a73bb2e9c","repo":"prestodb/presto","slug":"setbinarystream","errorCode":null,"errorMessage":"setBinaryStream","messagePattern":"setBinaryStream","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoPreparedStatement.java","lineNumber":659,"sourceCode":"    @Override\n    public void setCharacterStream(int parameterIndex, Reader reader, long length)\n            throws SQLException\n    {\n        throw new NotImplementedException(\"PreparedStatement\", \"setCharacterStream\");\n    }\n\n    @Override\n    public void setAsciiStream(int parameterIndex, InputStream x)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"setAsciiStream\");\n    }\n\n    @Override\n    public void setBinaryStream(int parameterIndex, InputStream x)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"setBinaryStream\");\n    }\n\n    @Override\n    public void setCharacterStream(int parameterIndex, Reader reader)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"setCharacterStream\");\n    }\n\n    @Override\n    public void setNCharacterStream(int parameterIndex, Reader value)\n            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"setNCharacterStream\");\n    }\n\n    @Override\n    public void setClob(int parameterIndex, Reader reader)","sourceCodeStart":641,"sourceCodeEnd":677,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoPreparedStatement.java#L641-L677","documentation":"The length-less PreparedStatement.setBinaryStream(int, InputStream) is unsupported in Presto's JDBC driver and throws SQLFeatureNotSupportedException. Binary data cannot be streamed into parameters; the driver only accepts concrete values.","triggerScenarios":"Calling PreparedStatement.setBinaryStream(parameterIndex, inputStream) on a PrestoPreparedStatement.","commonSituations":"JDBC 4 code paths that skip the length argument; generic data-loading tools streaming binary columns.","solutions":["Read the InputStream fully into a byte[] and call setBytes(parameterIndex, bytes)","Use setObject(parameterIndex, byteArray)","Store large binaries outside Presto and reference them by path/URI in a VARCHAR parameter","Add a capability check before using any stream setter with this driver"],"exampleFix":"// before\nps.setBinaryStream(1, in);\n// after\nps.setBytes(1, in.readAllBytes());","handlingStrategy":"try-catch","validationCode":"if (value instanceof InputStream) {\n    throw new IllegalStateException(\"Presto JDBC does not support setBinaryStream; use setBytes\");\n}","typeGuard":"boolean isSupportedParamType(Object v) {\n    return v instanceof String || v instanceof Number || v instanceof Boolean\n        || v instanceof byte[] || v instanceof java.sql.Date\n        || v instanceof java.sql.Time || v instanceof java.sql.Timestamp;\n}","tryCatchPattern":"try {\n    ps.setBinaryStream(idx, is);\n} catch (SQLFeatureNotSupportedException e) {\n    ps.setBytes(idx, is.readAllBytes());\n}","preventionTips":["Bind binary data as byte[] with setBytes for Presto VARBINARY columns","Store large binaries in object storage, not in Presto tables","Avoid generic JDBC data-loading frameworks that default to stream setters","Add integration tests covering all parameter types your code binds"],"tags":["jdbc","presto","unsupported-feature"],"backgroundTag":"jdbc-method-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"}