prestodb/presto · error · SQLFeatureNotSupportedException

createBlob

Error message

createBlob

What it means

PrestoConnection.createBlob() unconditionally throws SQLFeatureNotSupportedException("createBlob"). The driver does not implement JDBC Blob creation; there is no server round trip and the call always fails. Binary data must be sent with regular binary APIs instead.

Source

Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoConnection.java:512

    @Override
    public PreparedStatement prepareStatement(String sql, String[] columnNames)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("prepareStatement");
    }

    @Override
    public Clob createClob()
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("createClob");
    }

    @Override
    public Blob createBlob()
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("createBlob");
    }

    @Override
    public NClob createNClob()
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("createNClob");
    }

    @Override
    public SQLXML createSQLXML()
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("createSQLXML");
    }

    @Override
    public boolean isValid(int timeout)

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Bind binary data directly with setBytes/setBinaryStream for VARBINARY columns
  2. Remove Blob wrappers from the data path and pass byte[] or InputStream
  3. Add a driver capability check so Blob paths fall back to plain binary binding

Example fix

// before
Blob blob = connection.createBlob();
blob.setBytes(1, data);
ps.setBlob(1, blob);
// after
ps.setBytes(1, data);
Defensive patterns

Strategy: try-catch

Validate before calling

DatabaseMetaData meta = connection.getMetaData();
if (meta.getDriverName().contains("Presto")) {
    // driver does not support createBlob — use byte[]/stream binding
}

Type guard

static boolean supportsClientBlob(DatabaseMetaData meta) throws SQLException {
    return !meta.getDriverName().contains("Presto");
}

Try / catch

try {
    Blob blob = connection.createBlob();
    // ... use blob
} catch (SQLFeatureNotSupportedException e) {
    // fall back: ps.setBytes(...) / ps.setBinaryStream(...)
}

Prevention

When it happens

Trigger: Calling connection.createBlob(), or frameworks that wrap byte[]/InputStream payloads in a Blob for PreparedStatement.setBlob.

Common situations: Porting code from drivers with Blob support; ORMs mapping Types.BLOB columns; ETL pipelines writing VARBINARY via generic Blob helpers.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/6fb801bbe366523e. Report an issue: GitHub.