Managing transactions

UltraLite provides transaction processing to ensure the integrity of the data in your database. A transaction is a logical unit of work. Either the entire transaction is executed, or none of the statements in the transaction are executed.

By default, UltraLite for M-Business Anywhere operates in autoCommit mode. In autoCommit mode, each insert, update, or delete is executed as a separate transaction. Once the operation is completed, the change is made to the database.

If you set the Connection.autoCommit property to false, you can use multi-statement transactions. For example, if your application transfers money between two accounts, the deduction from the source account and the addition to the destination account constitute a single transaction.

If autoCommit is false, you must execute a Connection.commit() statement to complete a transaction and make changes to your database permanent, or you may execute a Connection.rollback() statement to cancel all the operations of a transaction. Turning autoCommit off improves performance.

Note

Synchronization causes a commit even if you have autoCommit set to false.