{"record":{"id":"25c8e0cd5cfe914a","repo":"prestodb/presto","slug":"not-implemented-preparedstatement-setdate","errorCode":null,"errorMessage":"Not implemented: PreparedStatement.setDate","messagePattern":"Not implemented: PreparedStatement\\.setDate","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoPreparedStatement.java","lineNumber":526,"sourceCode":"            throws SQLException\n    {\n        throw new SQLFeatureNotSupportedException(\"setArray\");\n    }\n\n    @Override\n    public ResultSetMetaData getMetaData()\n            throws SQLException\n    {\n        try (Statement statement = connection().createStatement(); ResultSet resultSet = statement.executeQuery(\"DESCRIBE OUTPUT \" + statementName)) {\n            return new PrestoResultSetMetaData(getDescribeOutputColumnInfoList(resultSet));\n        }\n    }\n\n    @Override\n    public void setDate(int parameterIndex, Date x, Calendar cal)\n            throws SQLException\n    {\n        throw new NotImplementedException(\"PreparedStatement\", \"setDate\");\n    }\n\n    @Override\n    public void setTime(int parameterIndex, Time x, Calendar cal)\n            throws SQLException\n    {\n        throw new NotImplementedException(\"PreparedStatement\", \"setTime\");\n    }\n\n    @Override\n    public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal)\n            throws SQLException\n    {\n        throw new NotImplementedException(\"PreparedStatement\", \"setTimestamp\");\n    }\n\n    @Override\n    public void setNull(int parameterIndex, int sqlType, String typeName)","sourceCodeStart":508,"sourceCodeEnd":544,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoPreparedStatement.java#L508-L544","documentation":"setDate(int, Date, Calendar) — the Calendar-aware variant used for timezone-adjusted DATE binding — is not implemented in the Presto JDBC driver and throws NotImplementedException. The two-argument setDate is supported; only the Calendar overload is not.","triggerScenarios":"Calling PreparedStatement.setDate(parameterIndex, Date, Calendar) with a non-null Calendar on a Presto connection.","commonSituations":"Code ported from drivers that honor the Calendar for session-timezone conversion; developers trying to control timezone interpretation of dates.","solutions":["Use the two-argument setDate(parameterIndex, Date) instead.","Set the JVM/session timezone (user=... connection property) so the default conversion matches your need.","Pre-convert the java.util.Date to the desired zone with a Calendar yourself, then bind with plain setDate."],"exampleFix":"// before\nps.setDate(1, sqlDate, cal);\n// after\nps.setDate(1, new java.sql.Date(sqlDate.getTime()));","handlingStrategy":"fallback","validationCode":"if (cal != null) { /* pre-convert the Date yourself and call the 2-arg setDate */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the two-argument setDate overload","Handle timezone conversion explicitly with Calendar before binding","Verify driver API support against its javadoc before using Calendar overloads"],"tags":["jdbc","presto","unimplemented","timezone"],"backgroundTag":"jdbc-feature-not-implemented","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}