{"record":{"id":"02410cbf6bed5213","repo":"tursodatabase/turso","slug":"turso-only-supports-close-cursors-at-commit","errorCode":null,"errorMessage":"turso only supports CLOSE_CURSORS_AT_COMMIT","messagePattern":"turso only supports CLOSE_CURSORS_AT_COMMIT","errorType":"exception","errorClass":"java.sql.SQLException","httpStatus":null,"severity":"error","filePath":"bindings/java/src/main/java/tech/turso/jdbc4/JDBC4Connection.java","lineNumber":180,"sourceCode":"\n  @Override\n  public void setTypeMap(Map<String, Class<?>> map) throws SQLException {\n    synchronized (this) {\n      this.typeMap = map;\n    }\n  }\n\n  @Override\n  public int getHoldability() throws SQLException {\n    connection.checkOpen();\n    return ResultSet.CLOSE_CURSORS_AT_COMMIT;\n  }\n\n  @Override\n  public void setHoldability(int holdability) throws SQLException {\n    connection.checkOpen();\n    if (holdability != ResultSet.CLOSE_CURSORS_AT_COMMIT) {\n      throw new SQLException(\"turso only supports CLOSE_CURSORS_AT_COMMIT\");\n    }\n  }\n\n  @Override\n  @SkipNullableCheck\n  public Savepoint setSavepoint() throws SQLException {\n    throw new SQLFeatureNotSupportedException(\"Savepoints are not supported by Turso\");\n  }\n\n  @Override\n  @SkipNullableCheck\n  public Savepoint setSavepoint(String name) throws SQLException {\n    throw new SQLFeatureNotSupportedException(\"Savepoints are not supported by Turso\");\n  }\n\n  @Override\n  public void rollback(Savepoint savepoint) throws SQLException {\n    throw new SQLFeatureNotSupportedException(\"Savepoints are not supported by Turso\");","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/tursodatabase/turso/blob/244cde92a7df7f9b8b8b7a4075c35a12977e303e/bindings/java/src/main/java/tech/turso/jdbc4/JDBC4Connection.java#L162-L198","documentation":"JDBC4Connection.setHoldability() rejects any holdability mode other than ResultSet.CLOSE_CURSORS_AT_COMMIT (value 2). Turso result sets are materialized and forward-only, so cursors never survive a commit, and the driver hard-rejects HOLD_CURSORS_AT_COMMIT (value 1) at JDBC4Connection.java:180. getHoldability() always returns 2, so the accepted configuration is simply 'never set holdability'.","triggerScenarios":"connection.setHoldability(ResultSet.HOLD_CURSORS_AT_COMMIT); connection.setHoldability(1); pools or frameworks that push a default holdability onto every connection (DBCP2 defaultHoldability, some Spring test configurations); code ported from PostgreSQL/Oracle where hold-over-commit cursors are normal.","commonSituations":"HikariCP/DBCP2 datasource properties copied from another database that include holdability settings; application-server connection factories that set all JDBC options uniformly; framework startup code that 'normalizes' connection properties and fails fast on turso; integration tests reused across databases.","solutions":["Remove the setHoldability() call entirely - turso's default (CLOSE_CURSORS_AT_COMMIT) is the only supported mode.","If a pool forces holdability, configure it to leave the driver default or explicitly set CLOSE_CURSORS_AT_COMMIT (2).","In shared code, guard the call: only set holdability when the value equals ResultSet.CLOSE_CURSORS_AT_COMMIT.","If you genuinely need cursors open across commits, turso cannot serve that access pattern - restructure to fetch data before committing."],"exampleFix":"// before\nconn.setHoldability(ResultSet.HOLD_CURSORS_AT_COMMIT); // throws\n\n// after\n// holdability is always CLOSE_CURSORS_AT_COMMIT in turso; just do not set it\n// or explicitly:\nconn.setHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT);","handlingStrategy":"validation","validationCode":"int desired = ResultSet.HOLD_CURSORS_AT_COMMIT;\nif (desired != ResultSet.CLOSE_CURSORS_AT_COMMIT) {\n    // skip setting holdability; turso only supports CLOSE_CURSORS_AT_COMMIT\n} else {\n    conn.setHoldability(desired);\n}","typeGuard":null,"tryCatchPattern":"try {\n    conn.setHoldability(holdability);\n} catch (SQLException e) {\n    if (e.getMessage().contains(\"CLOSE_CURSORS_AT_COMMIT\")) {\n        // holdability unsupported; proceed with driver default\n    } else { throw e; }\n}","preventionTips":["Never configure holdability in pooled datasource properties for turso.","Audit connection-factory code copied from other databases for setHoldability calls.","getHoldability() always returns CLOSE_CURSORS_AT_COMMIT - design cursor usage accordingly.","Do not rely on cursors surviving commit; fetch data before committing."],"tags":["java","jdbc","turso","connection-config","holdability"],"backgroundTag":"jdbc-holdability-unsupported","analyzedSha":"244cde92a7df7f9b8b8b7a4075c35a12977e303e","analyzedAt":"2026-08-20T07:02:18.389Z","contentChangedAt":"2026-08-20T07:02:18.389Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}