Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 12.0.0 » SQL Anywhere Server - SQL Usage » Using transactions and isolation levels


Using transactions

SQL Anywhere expects you to group your commands 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 command.

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: data definition commands, such as ALTER, CREATE, COMMENT, and DROP all 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.

    For more information about autocommit, see Setting autocommit or manual commit mode.

  • 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.

    For more information, see Setting autocommit or manual commit mode, and chained option.

 Options in Interactive SQL
 Determining when a transaction began