prestodb/presto · error · NotImplementedException
Not implemented: PreparedStatement.setCharacterStream
Error message
Not implemented: PreparedStatement.setCharacterStream
What it means
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.
Source
Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoPreparedStatement.java:482
batchUpdateCounts[i] = getUpdateCount();
}
catch (SQLException e) {
long[] updateCounts = Arrays.stream(batchUpdateCounts).mapToLong(j -> j).toArray();
throw new BatchUpdateException(e.getMessage(), e.getSQLState(), e.getErrorCode(), updateCounts, e.getCause());
}
}
return batchUpdateCounts;
}
finally {
clearBatch();
}
}
@Override
public void setCharacterStream(int parameterIndex, Reader reader, int length)
throws SQLException
{
throw new NotImplementedException("PreparedStatement", "setCharacterStream");
}
@Override
public void setRef(int parameterIndex, Ref x)
throws SQLException
{
throw new SQLFeatureNotSupportedException("setRef");
}
@Override
public void setBlob(int parameterIndex, Blob x)
throws SQLException
{
throw new SQLFeatureNotSupportedException("setBlob");
}
@Override
public void setClob(int parameterIndex, Clob x)View on GitHub (pinned to 55bb57d202)
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.
Example fix
// before
ps.setCharacterStream(1, reader, length);
// after
String text = new BufferedReader(reader).lines().collect(Collectors.joining("\n"));
ps.setString(1, text); Defensive patterns
Strategy: fallback
Validate before calling
if (value instanceof Reader) { /* do not call setCharacterStream on Presto; read to String */ } Prevention
- 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
When it happens
Trigger: Calling PreparedStatement.setCharacterStream(int, Reader, int) (or its overloads) on a Presto connection.
Common situations: Porting legacy JDBC code written for MySQL/Oracle drivers that streams large text into CLOB/text columns.
Related errors
- Not implemented: PreparedStatement.setDate
- Not implemented: PreparedStatement.setTime
- Not implemented: PreparedStatement.setTimestamp
- NOT_SUPPORTED
- createClob
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/46f71a0b78caa60d.
Report an issue: GitHub.