tursodatabase/turso · error · SQLFeatureNotSupportedException

Savepoints are not supported by Turso

Error message

Savepoints are not supported by Turso

What it means

Connection.setSavepoint() is unconditionally unsupported: turso (like SQLite) has no savepoint/nested-transaction concept exposed through this driver, so JDBC4Connection.java:187 throws SQLFeatureNotSupportedException. Savepoints are the JDBC mechanism for partial rollback inside a transaction, and their absence means every transaction is all-or-nothing. This is a SQLException subclass, so generic catch (SQLException) handlers will intercept it.

Solutions

  1. Remove savepoint usage and restructure logic so each transaction is atomic - do validation before BEGIN or split into separate transactions.
  2. In Spring, replace Propagation.NESTED with Propagation.REQUIRED or REQUIRES_NEW (a separate physical transaction).
  3. If a third-party library calls setSavepoint, wrap the connection or catch SQLFeatureNotSupportedException and disable that library's savepoint mode.
  4. For retryable sub-work, track applied changes in application state and compensate manually instead of rolling back to a savepoint.

Example fix

// before
Savepoint sp = conn.setSavepoint();
try { riskyWork(conn); }
catch (Exception e) { conn.rollback(sp); }

// after
// turso has no savepoints: verify first, keep the transaction atomic
if (!preconditionsOk()) { throw new IllegalArgumentException("..."); }
try { conn.setAutoCommit(false); riskyWork(conn); conn.commit(); }
catch (Exception e) { conn.rollback(); }
Defensive patterns

Strategy: try-catch

Validate before calling

// capability check: turso does not support savepoints
// verify driver/database up front and branch your transaction strategy
boolean supportsSavepoints = false; // for turso
if (!supportsSavepoints) { /* use plain transactions */ }

Try / catch

try {
    Savepoint sp = conn.setSavepoint();
} catch (SQLFeatureNotSupportedException e) {
    // savepoints unsupported: fall back to full transaction rollback
}

Prevention

When it happens

Trigger: Direct calls to connection.setSavepoint(); Spring's PROPAGATION_NESTED @Transactional (DataSourceTransactionManager creates JDBC savepoints for nested transactions); batch frameworks that checkpoint work with savepoints; transaction template code ported from PostgreSQL/SQL Server.

Common situations: Spring apps using propagation = Propagation.NESTED; generic DAO frameworks (e.g., older iBATIS/JTA-style code) that call setSavepoint when a transaction is active; migration from drivers where savepoints worked; unit-test infrastructure that verifies rollback behavior via savepoints.

Related errors


AI-assisted analysis of tursodatabase/turso@244cde92a7 (2026-08-20). Data as JSON: /api/errors/f1f3cc0fc16153a7. Report an issue: GitHub.

Appendix: source

Thrown at bindings/java/src/main/java/tech/turso/jdbc4/JDBC4Connection.java:187

  @Override
  public int getHoldability() throws SQLException {
    connection.checkOpen();
    return ResultSet.CLOSE_CURSORS_AT_COMMIT;
  }

  @Override
  public void setHoldability(int holdability) throws SQLException {
    connection.checkOpen();
    if (holdability != ResultSet.CLOSE_CURSORS_AT_COMMIT) {
      throw new SQLException("turso only supports CLOSE_CURSORS_AT_COMMIT");
    }
  }

  @Override
  @SkipNullableCheck
  public Savepoint setSavepoint() throws SQLException {
    throw new SQLFeatureNotSupportedException("Savepoints are not supported by Turso");
  }

  @Override
  @SkipNullableCheck
  public Savepoint setSavepoint(String name) throws SQLException {
    throw new SQLFeatureNotSupportedException("Savepoints are not supported by Turso");
  }

  @Override
  public void rollback(Savepoint savepoint) throws SQLException {
    throw new SQLFeatureNotSupportedException("Savepoints are not supported by Turso");
  }

  @Override
  public void releaseSavepoint(Savepoint savepoint) throws SQLException {
    throw new SQLFeatureNotSupportedException("Savepoints are not supported by Turso");
  }

View on GitHub (pinned to 244cde92a7)