setAutoCommit Method (SQLServerConnection)

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

public void setAutoCommit(boolean value)

参数

value

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

异常

SQLServerException

备注

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.

备注

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

另请参见

参考

SQLServerConnection Class

概念

SQLServerConnection Methods
SQLServerConnection Members