Transactions

SQL Anywhere expects you to group your statements into transactions. You commit a transaction to make changes to your database permanent. When you alter data, your alterations are recorded in the transaction log and are not made permanent until you enter the COMMIT statement.

Transactions start with one of the following events:

  • The first statement following a connection to a database.

  • The first statement following the end of a transaction.

Transactions complete with one of the following events:

  • A COMMIT statement makes the changes to the database permanent.

  • A ROLLBACK statement undoes all the changes made by the transaction.

  • A statement with a side effect of an automatic commit is executed: most data definition statements, such as ALTER, CREATE, COMMENT, and DROP have the side effect of an automatic commit.

  • A disconnection from a database performs an implicit rollback.

  • ODBC and JDBC have an autocommit setting that enforces a COMMIT after each statement. By default, ODBC and JDBC require autocommit to be on, and each statement is a single transaction. If you want to take advantage of transaction design possibilities, then you should turn autocommit off.

  • Setting the chained database option to Off is similar to enforcing an autocommit after each statement. By default, connections that use jConnect or Open Client applications have chained set to Off.

 Options in Interactive SQL
 Determining when a transaction began
 See also