Databases in which a transaction is always active

These are typically mainstream commercial relational databases with “ANSI standard” transaction behavior. If AutoCommit is off, then changes to the database won’t have any lasting effect unless commit is called (but see also disconnect). If rollback is called, then any changes since the last commit are undone.

If AutoCommit is on, then the effect is the same as if the DBI called commit automatically after every successful database operation. In other words, calling commit or rollback explicitly while AutoCommit is on would be ineffective because the changes would have already been commited.

Changing AutoCommit from off to on should issue a commit in most drivers.

Changing AutoCommit from on to off should have no immediate effect.

For databases that don’t support a specific autocommit mode, the driver has to commit each statement automatically using an explicit COMMIT after it completes successfully (and roll it back using an explicit rollback if it fails). The error information reported to the application will correspond to the statement that was executed, unless it succeeded and the commit or rollback failed.

Get Programming the Perl DBI now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.