Condividi tramite


setAutoCommit Method (SQLServerConnection)

Sets the auto-commit mode for this SQLServerConnection object to the given state.

public void setAutoCommit(boolean value)

Parametri

value

true to enable auto-commit mode for the connection, false to disable it.

Eccezioni

SQLServerException

Osservazioni

This setAutoCommit method is specified by the setAutoCommit method in the java.sql.Connection interface.

If a connection is in auto-commit mode, then all its SQL statements are run and committed as individual transactions. Otherwise, its SQL statements are grouped into transactions that are ended by a call to either the commit method or the rollback method. By default, new connections are in auto-commit mode.

The commit occurs when the statement completes or the next run occurs, whichever comes first. In the case of statements that return a SQLServerResultSet object, the statement completes when the last row of the result set has been retrieved, or when the result set has been closed. In advanced cases, a single statement might return multiple results in addition to output parameter values. In these cases, the commit occurs when all results and output parameter values have been retrieved.

When the auto-commit mode is false, the JDBC driver will implicitly start a new transaction after each commit.

Nota

If this method is called during a transaction, the transaction is committed.

Vedere anche

Riferimento

SQLServerConnection Class

Concetti

SQLServerConnection Methods
SQLServerConnection Members