A transaction is a series of changes to a database which either all must succeed or all must fail, for example, when transferring money from a checking account to a savings account, either the money can first be added to the savings account, then subtracted from the checking account, or first subtracted from the checking account, then added to the savings account. If for some reason one of these fails, the other must not be completed.

A transaction is started with the DB.Begin Method, is done when either it is completed by use of the DB.Commit method, or fails by use of the DB.Rollback method.

Within MySQL, transactions can only be executed with transaction safe tables: BDB and InnoDB. The other MySQL table types (ISAM, MyISAM and HEAP) commit immediately.

PostgreSQL does not support nested transactions, so only the first call to DB.Begin and the last call to DB.Commit or DB.Rollback are effective.