Lock Holder; Transaction Management; Statement Atomicity - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

Lock mode is sometimes determined by Neoview SQL. SQL ensures that an exclusive lock is in
effect for write operations and usually acquires a shared lock for operations that access data
without modifying it. You choose lock mode in these instances:
On the LOCK TABLE statement, you can choose EXCLUSIVE or SHARE.
On the SELECT statement, you can specify IN EXCLUSIVE MODE or IN SHARE MODE.

Lock Holder

Only the lock holder can release a lock:
A transaction releases the locks it holds at the end of the transaction in either of these cases:
— Locks on data read using SERIALIZABLE access
— Locks on rows updated
A process can hold a lock over the duration of one (or more) transactions, or the process can
release the lock before the transaction completes. A process releases the locks it holds by
issuing statements that affect the locks.

Transaction Management

A transaction (a set of database changes that must be completed as a group) is the basic recoverable
unit in case of a failure or transaction interruption. Transactions are controlled through client
tools that interact with the database using ODBC or JDBC. The typical order of events is:
1.
Transaction is started.
2.
Database changes are made.
3.
Transaction is committed.
If, however, the changes cannot be made or if you do not want to complete the transaction, you
can abort the transaction so that the database is rolled back to its original state.
SET TRANSACTION AUTOBEGIN OFF prevents Neoview SQL from automatically starting a
transaction.
This subsection discusses these considerations for transaction management:
"Statement Atomicity" (page 32)
"User-Defined and System-Defined Transactions" (page 33)
"Rules for DML Statements" (page 33)
"Effect of AUTOCOMMIT Option" (page 33)
"Concurrency" (page 33)
"Transaction Access Modes" (page 35)
"Transaction Isolation Levels" (page 36)

Statement Atomicity

To maintain database consistency, transactions must be controlled so that they complete
successfully or are aborted. SQL, by default does not automatically abort transactions following
an error, in most situations.
SQL guarantees that an individual SQL statement within a transaction completes successfully
or has no effect on the database.
When an INSERT, UPDATE, or DELETE statement encounters an error, that transaction is not
aborted, but continues. The effect of the SQL statement is rolled back, so the statement has no
effect on the database, but the transaction is not aborted.
32
Introduction

Advertisement

Table of Contents
loading

Table of Contents