ASA Getting Started
Updating the Database
Adaptive Server Anywhere expects you to group your commands into transactions. You commit a transaction to make changes to your database permanent. When you alter your data, your alterations are not made permanent right away. Instead, they are stored in your transaction log and are made permanent when you enter the COMMIT command.
Knowing which commands or actions signify the start or end of a transaction lets you take full advantage of transactions.
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: Database 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.
Interactive SQL provides you with two options which let you control when and how transactions end:
If you set the option AUTO_COMMIT to ON, Interactive SQL automatically commits your results following every successful statement and automatically performs a ROLLBACK after each failed statement.
The setting of the option COMMIT_ON_EXIT controls what happens to uncommitted changes when you exit Interactive SQL. If this option is set to ON (the default), Interactive SQL does a COMMIT; otherwise it undoes your uncommitted changes with a ROLLBACK statement.
If you are using a data sourceBy default, ODBC operates in autocommit mode. Even if you have set the AUTO_COMMIT option to OFF in Interactive SQL, ODBC's setting will override Interactive SQL's. You can change ODBC's setting using the SQL_ATTR_AUTOCOMMIT connection attribute. ODBC autocommit is independent of the CHAINED option. |
Adaptive Server Anywhere also supports Transact-SQL commands, such as BEGIN TRANSACTION, for compatibility with Sybase Adaptive Server Enterprise.
For further information, see An overview of Transact-SQL support.
Making changes permanent
Canceling changes
Transactions and data recovery