The HTTP Query API does not support transactions. To use transactions, connect to the Ocient System with the Ocient JDBC driver or the pyocient module.
The Connector supports transactions and performs the commit and rollback actions automatically. When you use the Spark Connector, you do not need to issue COMMIT or ROLLBACK statements.
SET AUTOCOMMIT
Enables or disables autocommit mode for the connection. When autocommit is enabled, the database commits each statement immediately. This mode is the default. When autocommit is disabled, the database groups subsequent statements into a transaction that you complete with the COMMIT or ROLLBACK statements. Valid values are:ON— Enables autocommit mode, in which the database commits each statement immediately. This value is the default.OFF— Disables autocommit mode. The database groups subsequent statements into a transaction until you enter the COMMIT or ROLLBACK statement.
OFF to ON, the database commits any pending transactions.
After you disable autocommit, ensure that you execute SQL statements that are supported by transactions. Otherwise, the database throws an error. For a list of supported statements, see Transactions.
Syntax
SQL
SQL
SQL
public.txn_demo table and commit these two transactions.
SQL
SQL
COMMIT
Commits the current transaction and permanently saves all changes made after the transaction started. This statement applies only when you disable autocommit with SET AUTOCOMMIT. When autocommit is enabled, COMMIT has no effect. SyntaxSQL
public.txn_demo table, and then commits the transaction to permanently save the rows.
Disable the autocommit.
SQL
SQL
public.txn_demo table and commit these two transactions.
SQL
SQL
ROLLBACK
Rolls back the current transaction and discards all changes made after the transaction started. This statement applies only when you disable autocommit with SET AUTOCOMMIT. When autocommit is enabled, ROLLBACK has no effect. SyntaxSQL
SQL
public.txn_demo table with two columns: a number and a string.
SQL
public.txn_demo table, then roll back both transactions.
SQL
SQL

