prestodb/presto · error · NotImplementedException

Not implemented: PreparedStatement.setTimestamp

Error message

Not implemented: PreparedStatement.setTimestamp

What it means

setTimestamp(int, Timestamp, Calendar) — the Calendar-aware TIMESTAMP binding — is not implemented in the Presto JDBC driver and throws NotImplementedException. Only the two-argument setTimestamp is supported.

Source

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

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

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

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

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Use the two-argument setTimestamp(parameterIndex, Timestamp).
  2. Pre-convert the instant to the target timezone and bind with the simple overload.
  3. Set the connection/session timezone so default conversions match expectations.

Example fix

// before
ps.setTimestamp(1, ts, cal);
// after
ps.setTimestamp(1, ts);
Defensive patterns

Strategy: fallback

Validate before calling

if (cal != null) { /* pre-convert the Timestamp yourself and call the 2-arg setTimestamp */ }

Prevention

When it happens

Trigger: Calling PreparedStatement.setTimestamp(parameterIndex, Timestamp, Calendar) on a Presto connection.

Common situations: Ported enterprise code that uses Calendar overloads to pin timestamps to a business timezone.

Related errors


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