AutoCommit

This property specifies whether to commit each SQL statement implicitly or only until an explicit commit occurs.

Declaration

// C#
public bool AutoCommit {get; set;}

Property Value

Bool

Exception

System.ObjectDisposedException – This property cannot be accessed after the OracleConnection object is already disposed.

Remarks

By default, this property is set to true, which commits each SQL statement implicitly.

This property can be set before or after the connection opens.

If the AutoCommit property is toggled from false to true, the current transaction is committed.

When an explicit transaction is created, this property will be set to false. Once the explicit transaction is committed or rolled back, the property value reverts to the originally set AutoCommit value.

If a local transaction is already started implicitly, invoking BeginTransaction() will inherit the transaction that was implicitly started.

If the transaction is created explicitly using BeginTransaction(), the transaction can be operated on either through the OracleConnection methods or OracleTransaction methods. But once the transaction is over via a Commit() or a Rollback() invoked on either object, the OracleTransaction cannot be used henceforth.

If the OracleConnection object is closed while an implicit transaction is underway, the transaction is rolled back. After the AutoCommit property is set, that setting is honored for all subsequent Open() calls on that specific OracleConnection object until the AutoCommit value is modified.