{"record":{"id":"03f9437e97e6c7d8","repo":"prestodb/presto","slug":"setasciistream","errorCode":null,"errorMessage":"setAsciiStream","messagePattern":"setAsciiStream","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoPreparedStatement.java","lineNumber":652,"sourceCode":"    @Override\n    public void setBinaryStream(int parameterIndex, InputStream x, long length)\n            throws SQLException\n    {\n        throw new NotImplementedException(\"PreparedStatement\", \"setBinaryStream\");\n    }\n\n    @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)","sourceCodeStart":634,"sourceCodeEnd":670,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoPreparedStatement.java#L634-L670","documentation":"The no-length variant PreparedStatement.setAsciiStream(int, InputStream) is unsupported in Presto's JDBC driver and throws SQLFeatureNotSupportedException. Unlike the length variants (which throw NotImplementedException), this JDBC 4 API is marked as a feature the driver intentionally does not support.","triggerScenarios":"Calling PreparedStatement.setAsciiStream(parameterIndex, inputStream) (no length argument) on a PrestoPreparedStatement.","commonSituations":"JDBC 4.x style code omitting the length parameter; libraries that prefer the length-less stream setters when available.","solutions":["Convert the InputStream to a String and call setString(parameterIndex, value)","Use the length-based APIs — note they also throw NotImplementedException in this driver, so avoid all stream setters","Pass the text value via setObject","Restrict to supported types: primitives, String, byte[], java.sql types"],"exampleFix":"// before\nps.setAsciiStream(1, in);\n// after\nps.setString(1, new String(in.readAllBytes(), StandardCharsets.US_ASCII));","handlingStrategy":"try-catch","validationCode":"if (value instanceof InputStream) {\n    throw new IllegalStateException(\"Presto JDBC does not support setAsciiStream; use setString\");\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.setAsciiStream(idx, is);\n} catch (SQLFeatureNotSupportedException e) {\n    ps.setString(idx, new String(is.readAllBytes(), StandardCharsets.US_ASCII));\n}","preventionTips":["Avoid JDBC 4 length-less stream setters with Presto","Wrap binding in a helper that only exposes supported setters","Grep your codebase for setAsciiStream/setBinaryStream/setCharacterStream usages","Keep Presto bindings in a separate code path from other databases"],"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"}