Changing Default Transaction Behavior
You can change default transaction behavior as follows:
-
To prevent updates to database content, explicitly start a transaction and specify that it is read only:
START TRANSACTION READ ONLY
(seeSTART TRANSACTION
). This starts an explicit transaction (see About Implicit and Explicit Transactions ) which will suspend theAUTOCOMMIT
setting. This setting affects only the newly started transaction. -
To change default autocommit behavior, specify
SET AUTOCOMMIT OFF
(SeeSET
). When autocommit behavior is disabled and there is noSTART TRANSACTION
statement, then execution of a statement implicitly starts a transaction. This transaction remains open until aCOMMIT
orROLLBACK
statement is executed (seeCOMMIT
,ROLLBACK
). Autocommit remains disabled unless there is aSET AUTOCOMMIT ON
statement or the connection closes. -
To change the default transaction isolation level, specify
SET ISOLATION LEVEL isolation_level
. The new setting is in effect with the start of the next transaction and stays in effect unless the level is reset with anotherSET
command or the connection closes. See Supported Transaction Isolation Levels for a description of each transaction isolation level that NuoDB supports.
Another way to set the default transaction isolation level is to specify the isolation connection property when you open a connection. For example:nuosql test@localhost --user dba --password dba --connection-property isolation=read_committed