Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - Programming » Application development using SQL » Transactions in applications » Autocommit and manual commit mode

 

Autocommit implementation details

Autocommit mode has slightly different behavior depending on the interface and provider that you are using and how you control the autocommit behavior.

Autocommit mode can be implemented in one of two ways:

  • Client-side autocommit   When an application uses autocommit, the client-library sends a COMMIT statement after each SQL statement executed.

    ADO.NET, ADO/OLE DB, ODBC, PHP, and SQL Anywhere JDBC driver applications control commit behavior from the client side.

  • Server-side autocommit   When an application turns off chained mode, the database server commits the results of each SQL statement. For the Sybase jConnect JDBC driver, this behavior is controlled by the chained database option.

    Embedded SQL, the jConnect driver, and Open Client applications manipulate server-side commit behavior (for example, they set the chained option).

For compound statements such as stored procedures or triggers there is a difference between client-side and server-side autocommit. From the client side, a stored procedure is a single statement, and so autocommit sends a single commit statement after the whole procedure is executed. From the database server perspective, the stored procedure may be composed of many SQL statements, and so server-side autocommit commits the results of each SQL statement within the procedure.

Note

Do not mix client-side and server-side implementations. You should not combine the setting of the chained option with the setting of the autocommit option in your SQL Anywhere ADO.NET, OLE DB, ODBC, PHP, or JDBC application.