# Autocommit command

The `Autocommit` command turns the connection's auto-commit mode on or off.

JDBC specifies that the default auto-commit mode is `ON`. Certain types of processing require that auto-commit mode be `OFF`. For information about auto-commit, see the Derby Developer's Guide.

If auto-commit mode is changed from off to on when there is a transaction outstanding, that work is committed when the current transaction commits, not at the time auto-commit is turned on. Use `Commit` or `Rollback` before turning on auto-commit when there is a transaction outstanding, so that all prior work is completed before the return to auto-commit mode.

## Syntax

    AUTOCOMMIT { ON | OFF }

## Example

    ij> autocommit off;
    ij> DROP TABLE menu;
    0 rows inserted/updated/deleted
    ij> CREATE TABLE menu (course CHAR(10), item CHAR(20), price INT);
    0 rows inserted/updated/deleted
    ij> INSERT INTO menu VALUES ('entree', 'lamb chop', 14),
    ('dessert', 'creme brulee', 6),
    ('appetizer', 'baby greens', 7);
    3 rows inserted/updated/deleted
    ij> commit;
    ij> autocommit on;
    ij>

Parent topic: ij commands and errors reference
Related concepts
ij commands
ij errors
Related reference
Absolute command
After Last command
Async command
Before First command
Close command
Commit command
Connect command
Describe command
Disconnect command
Driver command
Elapsedtime command
Execute command
Exit command
First command
Get Cursor command
Get Scroll Insensitive Cursor command
Help command
HoldForConnection command
Last command
LocalizedDisplay command
MaximumDisplayWidth command
Next command
NoHoldForConnection command
Prepare command
Previous command
Protocol command
Readonly command
Relative command
Remove command
Rollback command
Run command
Set Connection command
Show command
Wait For command
Syntax for comments in ij commands
Syntax for identifiers in ij commands
Syntax for strings in ij commands