Rediger

Del via


setAutoCommit Method (SQLServerConnection)

Download JDBC driver

Sets the autocommit mode for this SQLServerConnection object to the given state.

Syntax

  
public void setAutoCommit(boolean value)  

Parameters

value

true to enable autocommit mode for the connection, false to disable it.

Exceptions

SQLServerException

Remarks

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

If a connection is in autocommit 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 autocommit mode.

The commit occurs when the statement completes or the next run occurs, whichever comes first. When statements 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 autocommit mode is false, the JDBC driver will implicitly start a new transaction after each commit.

Note

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

See Also

SQLServerConnection Members
SQLServerConnection Class