{"record":{"id":"83beef533a720755","repo":"prestodb/presto","slug":"result-set-holdability-must-be-hold-cursors-over-c","errorCode":null,"errorMessage":"Result set holdability must be HOLD_CURSORS_OVER_COMMIT","messagePattern":"Result set holdability must be HOLD_CURSORS_OVER_COMMIT","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoConnection.java","lineNumber":905,"sourceCode":"        }\n    }\n\n    private static void checkResultSet(int resultSetType, int resultSetConcurrency)\n            throws SQLFeatureNotSupportedException\n    {\n        if (resultSetType != ResultSet.TYPE_FORWARD_ONLY) {\n            throw new SQLFeatureNotSupportedException(\"Result set type must be TYPE_FORWARD_ONLY\");\n        }\n        if (resultSetConcurrency != ResultSet.CONCUR_READ_ONLY) {\n            throw new SQLFeatureNotSupportedException(\"Result set concurrency must be CONCUR_READ_ONLY\");\n        }\n    }\n\n    private static void checkHoldability(int resultSetHoldability)\n            throws SQLFeatureNotSupportedException\n    {\n        if (resultSetHoldability != ResultSet.HOLD_CURSORS_OVER_COMMIT) {\n            throw new SQLFeatureNotSupportedException(\"Result set holdability must be HOLD_CURSORS_OVER_COMMIT\");\n        }\n    }\n\n    private static String getIsolationLevel(int level)\n            throws SQLException\n    {\n        switch (level) {\n            case TRANSACTION_READ_UNCOMMITTED:\n                return \"READ UNCOMMITTED\";\n            case TRANSACTION_READ_COMMITTED:\n                return \"READ COMMITTED\";\n            case TRANSACTION_REPEATABLE_READ:\n                return \"REPEATABLE READ\";\n            case TRANSACTION_SERIALIZABLE:\n                return \"SERIALIZABLE\";\n        }\n        throw new SQLException(\"Invalid transaction isolation level: \" + level);\n    }","sourceCodeStart":887,"sourceCodeEnd":923,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoConnection.java#L887-L923","documentation":"PrestoConnection.checkHoldability() throws SQLFeatureNotSupportedException when the requested resultSetHoldability is not ResultSet.HOLD_CURSORS_OVER_COMMIT. Presto has no cross-transaction cursor semantics; the driver only supports holdable cursors, rejecting CLOSE_CURSORS_AT_COMMIT in createStatement/prepareStatement/createStatement overload with holdability.","triggerScenarios":"createStatement(type, concurrency, ResultSet.CLOSE_CURSORS_AT_COMMIT); prepareStatement(sql, type, concurrency, ResultSet.CLOSE_CURSORS_AT_COMMIT); setHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT) on the connection.","commonSituations":"Transaction-management code ported from DB2/Oracle that pins cursor behavior to commit; frameworks that set holdability explicitly for rollback safety.","solutions":["Pass ResultSet.HOLD_CURSORS_OVER_COMMIT as the holdability argument","Do not call setHoldability with CLOSE_CURSORS_AT_COMMIT; omit it and use driver defaults","Restructure commit/rollback logic so it does not depend on cursors closing at commit"],"exampleFix":"// before\nStatement stmt = conn.createStatement(\n    ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY,\n    ResultSet.CLOSE_CURSORS_AT_COMMIT);\n// after\nStatement stmt = conn.createStatement(\n    ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY,\n    ResultSet.HOLD_CURSORS_OVER_COMMIT);","handlingStrategy":"validation","validationCode":"if (holdability != ResultSet.HOLD_CURSORS_OVER_COMMIT) {\n    holdability = ResultSet.HOLD_CURSORS_OVER_COMMIT; // only supported value\n}","typeGuard":null,"tryCatchPattern":"try {\n    stmt = conn.createStatement(type, concurrency, holdability);\n} catch (SQLFeatureNotSupportedException e) {\n    stmt = conn.createStatement();\n}","preventionTips":["Avoid setHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT) on Presto connections","Use the 3-arg createStatement overloads only when holdability is HOLD_CURSORS_OVER_COMMIT","Do not carry transactional cursor semantics from OLTP drivers into Presto"],"tags":["jdbc","unsupported-feature","transactions","presto"],"backgroundTag":"sqlfeaturenotsupported","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"}