prestodb/presto · warning · SQLFeatureNotSupportedException

setURL

Error message

setURL

What it means

PrestoPreparedStatement.setURL is an unimplemented JDBC 4 method stub that unconditionally throws SQLFeatureNotSupportedException. The Presto JDBC driver does not support binding java.net.URL parameters to prepared statements. Callers must use supported setter types (e.g. setString with the URL's string form) instead.

Source

Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoPreparedStatement.java:554

    @Override
    public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal)
            throws SQLException
    {
        throw new NotImplementedException("PreparedStatement", "setTimestamp");
    }

    @Override
    public void setNull(int parameterIndex, int sqlType, String typeName)
            throws SQLException
    {
        setNull(parameterIndex, sqlType);
    }

    @Override
    public void setURL(int parameterIndex, URL x)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("setURL");
    }

    @Override
    public ParameterMetaData getParameterMetaData()
            throws SQLException
    {
        throw new NotImplementedException("PreparedStatement", "getParameterMetaData");
    }

    @Override
    public void setRowId(int parameterIndex, RowId x)
            throws SQLException
    {
        throw new SQLFeatureNotSupportedException("setRowId");
    }

    @Override
    public void setNString(int parameterIndex, String value)

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Replace the call with setString(parameterIndex, x.toString()) and let the server cast the string to the target column type
  2. Cast the URL to String in application code before binding
  3. Check the Presto JDBC driver documentation for the supported parameter types list and adjust the mapping layer

Example fix

// before
pstmt.setURL(1, new URL("https://example.com"));
// after
pstmt.setString(1, "https://example.com");
Defensive patterns

Strategy: fallback

Validate before calling

if (x != null && !(x instanceof java.io.Serializable)) throw new IllegalArgumentException("URL must be serializable"); // bind as string instead
pstmt.setString(parameterIndex, x == null ? null : x.toString());

Type guard

boolean isSupportedSetter(Object v) { return v instanceof String || v instanceof Number || v instanceof Boolean || v instanceof java.time.temporal.Temporal || v instanceof byte[]; }

Try / catch

try { pstmt.setURL(idx, url); } catch (SQLFeatureNotSupportedException e) { pstmt.setString(idx, url.toString()); }

Prevention

When it happens

Trigger: Calling PreparedStatement.setURL(int parameterIndex, java.net.URL x) on a PrestoPreparedStatement; any framework that auto-maps a URL-typed bean field to setObject-style JDBC binding via setURL.

Common situations: ORM or data-migration tools binding java.net.URL columns; hand-written JDBC code ported from drivers (e.g. PostgreSQL, MySQL) that support setURL; generic query builders that reflect over parameter types and dispatch to setURL.

Related errors


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