19 The Paradox Driver : Multiuser Access to Database Files

Multiuser Access to Database Files
You can query Paradox database files that reside in a shared directory on a network or that are to be shared among applications running on a local workstation. If the database files are on a network server, multiple users can query these database files simultaneously. To share Paradox database files among multiple users, the database files must be located in a shared directory on your network server.
Two connection string attributes identify the Paradox database you are accessing: Database (database directory) and NetDir (network directory). The Database setting specifies the directory in which the Paradox database files are stored. If the Database setting you specify is a shared network directory, then Paradox requires a NetDir specification as well. This value identifies the directory containing the PARADOX.NET file that corresponds to the Database setting you have specified.
Every user who accesses the same shared directory of database files must set the NetDir value to point to the same PARADOX.NET file. If your connection string does not specify a NetDir value, then Paradox uses the NetDir value specified in the Paradox section of the IDAPI configuration file. This makes it important that the NetDir specification in each user’s IDAPI configuration file be set correctly.
Whenever you open a Paradox database file that another user opens at the same time, the consistency of the data becomes an issue if both individuals are updating the database file.
Locking
The Paradox driver has two locking levels: record locking and table locking. Database files that have no primary key always have a prevent write lock placed on the database file when the file is opened. The table lock is escalated to a write lock when an operation that changes the database file is attempted.
Database files that have primary keys use record locking. The locking level is escalated from record locking to a table write lock if the transaction runs out of record locks.
Primary keys provide the greatest concurrency for database files that are accessed and modified by multiple users.
NOTE: If a table lock is placed on a Paradox database file, the Paradox driver prevents users from updating and deleting records but does not prevent them from inserting records into the locked database file.