Skip to content
The latest version of DbVisualizer was released 2024-12-04DOWNLOAD HERE ->

Auto Commit, Commit and Rollback

With Auto Commit enabled, all changes you make to the database data is automatically committed after the successful execution of an SQL statement. Auto Commit is enabled for a connection by default. You can change the default in the Options area of the Object View tab for the connection.

You can toggle the Auto Commit setting for an open SQL Commander tab using the SQL Commander main menu item of the corresponding button in the SQL Commander toolbar. Alternatively, you can use this command in a script to set it:

@set autocommit on/off;

If Auto Commit is disabled, it is very important to manually issue the commit or rollback operations when appropriate. Use the Commit and Rollback buttons in the SQL Commander toolbar or the corresponding operations in the SQL Commander main menu to commit and rollback transactions.

Alternatively, you can use the following commands in a script executed in the SQL Commander:

@commit;
@rollback;

There is an Auto-Commit: ON/OFF indicator in the editor status bar:

autoCommitStatusbar

The first number represents the number of records updated in the database since the last commit/rollback. The second number shows the number of statements (except SELECTs) that has been executed since last commit/rollback.

Having Auto Commit off for a connection should be handled with great care since transactions may lock parts of the database (this is database dependent). To minimize the risk of forgetting uncommitted transactions, there is an Ask when Auto Commit is OFF settings in the connection Properties tab, in the Transactions category, that can be set to warn you when there are changes that hasn't been committed. You can set it to Always or When Uncommitted Updates. When set to When Uncommitted Updates, you are warned when there is at least one updated record reported by the database. For database that do not accurately report updated records, you can set it to Always to be warned if at least one statement (other than SELECT) has been executed since the last commit or rollback.

There is also a Pending Transactions at Disconnect setting in the Tool Properties dialog, in the Transaction category under the General tab. It specifies what DbVisualizer should do when you disconnect a connection that has pending changes, and you can set it to Commit, Rollback or Ask.