Accuracer: The First And Only BDE Alternative
Client-Server Single-File Embedded Database for Delphi / C++Builder / Kylix

Multi-User and Multi-Thread Support

Previous  Top  Next


Accuracer can be used both in multi-user and / or multi-therad environments as well as in single user mode.
The only restriction is a SU Std edition that can be used only in multi-thread environment, but not in multi-user.
The Trial version allows maximum 2 multi-user concurrent connections and up to 5 threads for database opened in Exclusive mode.

Multi-thread access is the case when there are several threads started in the single process and two or more of them can modify same tables simultaneously. This situation leads to lost changes or data corruption in database systems that are not multi-thread safe. All versions and editions of Accuracer are multi-thread safe. Look at Multi-Thread demo for example.

Multi-user access is when some different applications or multiple instances of the same application modifies the same tables simultaneously. There is no difference if these applications are run from different machines or they are started from the same computer - in any case it is a mult-thread access to the database. This situation is similar to multi-thread meaning that if database system is not multi-user there will be data losses or database corruption. The only edition of Accuracer that does not support multi-user access is SU Std. When you use SU Std it is highly recomended to open database files in Exclusive mode (set property Exclusive of TACRDatabase component to True). This will not influences multi-thread support, but will prevent database file from corruption by other applications. All other versions, including Trial version supports multi-user access.

Each thread or application should use its unique Session for correct work. Session in Accuracer is identified by unique SessionID value that gets each TACRQuery or TACRTable component that connects to the database. Each TACRSession or TACRDatabase component gets SessionID value when it connects to the database file first time. All TACRTable and TACRQuery components linked to the corresponding TACRSession or TACRDatabase component uses this value. All modifications made by transaction in the session are visible only to components of this Session until commit. Each session can contain only single active transaction.

Using Accuracer in Multi-Thread environment

There are two main methods of correct using Accuracer in multi-thread environment:
1) Create a TACRSession component in each thread and use same TACRDatabase component for all threads
2) Create a TACRDatabase component in each thread and use it by all TACRQuery and TACRTable components of this thread.
See Multi-Thread demo as an example.

Using Accuracer in Multi-User environment

There is no need in any configuration. Accuracer by default is ready for use in multi-user environment.
Read Locking Mechanism topic for better understanding of locking model used in Accuracer.
You can run two instances of ACRManager or SQLConsole utility and open same table in both ot them to see how it works.
Note:       Do not try to use SU Std version in multi-user mode !!!

Performance Optimization

Use Exclusive acces always when it is possible. If you need only multi-thread access to the database, but do not need multi-user access, set Exscluive property of TACRDatabase component to True before connecting the database. In this case all locks will be performed in memory, without locking any bytes in the physical database file. Locks will be checked much faster in this case.

If some tables can be used exclusively, set Exclusive property of TACRTable components to True before opening them. This will essentially speed up access to the records.

Use transactions for speeding up data read and modification.

© AidAim Software Accuracer: Contents-cross-platform Windows Linux Databas