zstan commented on code in PR #13112:
URL: https://github.com/apache/ignite/pull/13112#discussion_r3226641736
##########
docs/_docs/SQL/JDBC/jdbc-driver.adoc:
##########
@@ -555,6 +555,46 @@ In addition to generic DataSource properties,
`IgniteJdbcThinDataSource` support
Refer to the
link:{javadoc_base_url}/org/apache/ignite/IgniteJdbcThinDataSource.html[JavaDocs]
for more details.
+== Transaction Savepoints
+
+JDBC Thin Driver supports the standard JDBC savepoint API for explicit
transactions:
+
+* `Connection.setSavepoint()`
+* `Connection.setSavepoint(String name)`
+* `Connection.rollback(Savepoint savepoint)`
+* `Connection.releaseSavepoint(Savepoint savepoint)`
+
+Savepoints are available for JDBC connections that use the Calcite-based SQL
engine and explicit `PESSIMISTIC` transactions.
+Disable auto-commit before creating a savepoint.
+
+[source,java]
+----
+try (Connection conn = DriverManager.getConnection(
+ "jdbc:ignite:thin://127.0.0.1?transactionConcurrency=PESSIMISTIC")) {
+ conn.setAutoCommit(false);
+
+ try (Statement stmt = conn.createStatement()) {
+ stmt.executeUpdate("INSERT INTO Person(id, name) VALUES (1, 'John')");
+
+ Savepoint savepoint = conn.setSavepoint("before_update");
+
+ stmt.executeUpdate("UPDATE Person SET name = 'Jane' WHERE id = 1");
+
+ conn.rollback(savepoint);
+ conn.releaseSavepoint(savepoint);
Review Comment:
I think thid exception message is not enough ?
Transaction cannot be rolled back explicitly in auto-commit mode.
And need to be extended like :
Transaction cannot be rolled back explicitly in auto-commit mode, Set {@code
Connection#setAutoCommit} to {@code false} if you want ... smth like this
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]