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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Share locks<br />

<strong>Data</strong> source record locking<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 this<br />

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

MS <strong>SQL</strong> <strong>Server</strong> data source. The higher isolation levels will determine what kind of share locks<br />

will take effect. In MS <strong>SQL</strong> <strong>Server</strong>, a repeatable read and serializable isolation level are<br />

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 ODBC<br />

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

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 level is<br />

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

specified in an ABL statement.<br />

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

uncommitted or read committed. It may hold share locks until the completion of a<br />

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 apply a<br />

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

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

programming or data source reference manuals <strong>for</strong> more in<strong>for</strong>mation.<br />

Exclusive locks<br />

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

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

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

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

at the end of a transaction. In a <strong>OpenEdge</strong> transaction block, the data source always holds an<br />

exclusive lock until the end of a transaction’s scope if the data source driver supports<br />

commitment control boundaries and the ODBC AUTOCOMMIT feature is not turned on.<br />

Handling lock timeouts<br />

The default behavior <strong>for</strong> handling a lock timeout condition in the <strong>OpenEdge</strong> <strong>Data</strong><strong>Server</strong>s is to<br />

return control immediately to the <strong>OpenEdge</strong> client. There<strong>for</strong>e, the lock wait timeout at the data<br />

source is set to zero at the beginning of a client session when using the <strong>OpenEdge</strong> <strong>Data</strong><strong>Server</strong><br />

<strong>for</strong> MS <strong>SQL</strong> <strong>Server</strong>. This is desirable behavior <strong>for</strong> clients that want immediate control over lock<br />

handling. The client application can choose to handle the lock timeout directly using the<br />

NO-WAIT and NO-ERROR keywords. Then, when a record cannot be accessed because it is locked<br />

by another user, the application can test <strong>for</strong> the server timeout condition by testing <strong>for</strong> TRUE<br />

returned from the LOCKED function. The application consumes the timeout condition in this case<br />

and is free to per<strong>for</strong>m whatever action is deemed necessary.<br />

2–37

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

Saved successfully!

Ooh no, something went wrong!