13.01.2013 Views

OpenEdge Data Management: DataServer for Microsoft SQL Server

OpenEdge Data Management: DataServer for Microsoft SQL Server

OpenEdge Data Management: DataServer for Microsoft SQL Server

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 2: Initial Programming Considerations<br />

Table 18 shows the possible –Dsrv TXN_ISOLATION,n values with the respective<br />

meaning.<br />

Table 18: TXN_ISOLATION values in the –Dsrv parameter<br />

Share locks<br />

The default isolation level <strong>for</strong> the MS <strong>SQL</strong> <strong>Server</strong> <strong>Data</strong><strong>Server</strong> is read uncommitted. At<br />

this level, a SHARE-LOCK and NO-LOCK are identical from the perspective of the<br />

<strong>Data</strong><strong>Server</strong> and the MS <strong>SQL</strong> <strong>Server</strong> data source. The higher isolation levels will<br />

determine what kind of share locks will take effect. In MS <strong>SQL</strong> <strong>Server</strong>, a repeatable<br />

read and serializable isolation level are synonymous.<br />

The MS <strong>SQL</strong> <strong>Server</strong> <strong>Data</strong><strong>Server</strong> ignores ABL SHARE–LOCK option when used in ABL<br />

statements. Instead, share locks are governed by the data source and the available<br />

ODBC isolation levels. If you wish to change the share lock behavior, you may be able<br />

to do so by changing the isolation level at connection time using the -Dsrv parameter.<br />

When you read records with an ABL statement, regardless of whether you include the<br />

SHARE–LOCK option, the MS <strong>SQL</strong> <strong>Server</strong> data source typically per<strong>for</strong>ms as follows:<br />

• It puts some <strong>for</strong>m of share lock on the record, page, or table if the ODBC isolation<br />

level is anything other than read uncommitted. This occurs regardless of whether<br />

the share lock is specified in an ABL statement.<br />

• After the data source reads the record, it releases the share lock if the isolation<br />

level is read uncommitted or read committed. It may hold share locks until the<br />

completion of a transaction if the isolation level is repeatable read or serializable.<br />

If you hold a record with a share lock, other users can usually access that record and<br />

apply a share lock, but this is dependent on the isolation level they have selected. Refer<br />

to the transaction and locking references in the <strong>Microsoft</strong> documentation that<br />

addresses ODBC programming or data source reference manuals <strong>for</strong> more<br />

in<strong>for</strong>mation.<br />

Exclusive locks<br />

Value Meaning<br />

1 Read uncommitted (default)<br />

2 Read committed<br />

4 Repeatable read<br />

8 Serializable<br />

When you update, delete, or create a record, MS <strong>SQL</strong> <strong>Server</strong> puts an exclusive lock<br />

on the record; however, the data source does not apply the exclusive lock to a record<br />

until all share locks on it are released. There<strong>for</strong>e, you cannot per<strong>for</strong>m an update on a<br />

record until other users release it. If a record has an exclusive lock on it, no other user<br />

can access it until it is released at the end of a transaction. In a <strong>OpenEdge</strong> transaction<br />

block, the data source always holds an exclusive lock until the end of a transaction’s<br />

scope if the data source driver supports commitment control boundaries and the ODBC<br />

AUTOCOMMIT feature is not turned on.<br />

94 <strong>OpenEdge</strong> <strong>Data</strong> <strong>Management</strong>: <strong>Data</strong><strong>Server</strong> <strong>for</strong> <strong>Microsoft</strong> <strong>SQL</strong> <strong>Server</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!