prestodb/presto · error · SQLFeatureNotSupportedException

createClob

Error message

createClob

What it means

PrestoConnection.createClob() is a stub that unconditionally throws SQLFeatureNotSupportedException("createClob"). The Presto JDBC driver does not implement client-side Clob creation, so the method fails before any request reaches the server. This is intentional: Presto models large text as VARCHAR and the driver has no Clob support.

Source

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

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

    @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()

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Replace Clob usage with String: the driver supports setString/getString for VARCHAR columns
  2. Update ORM dialect/type mappings so CLOB-typed fields are bound as strings
  3. Guard driver-specific Clob paths with a capability check and fall back to setString

Example fix

// before
Clob clob = connection.createClob();
clob.setString(1, largeText);
ps.setClob(1, clob);
// after
ps.setString(1, largeText);
Defensive patterns

Strategy: try-catch

Validate before calling

DatabaseMetaData meta = connection.getMetaData();
if (meta.getDriverName().contains("Presto")) {
    // driver does not support createClob — use string binding
}

Type guard

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

Try / catch

try {
    Clob clob = connection.createClob();
    // ... use clob
} catch (SQLFeatureNotSupportedException e) {
    // fall back: bind text with ps.setString(...)
}

Prevention

When it happens

Trigger: Calling connection.createClob() directly, or an ORM/framework that materializes Clob objects for setString/setCharacterStream-style parameter binding.

Common situations: Porting code written against Oracle/Postgres drivers that use Clob for large text; Hibernate/JDBC type mappings forcing Types.CLOB; generic JDBC tools probing driver capabilities.

Related errors


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