AMT Help Files

Database Transactions

AMT uses a SQL-based server to manage the databases. To select records from the SQL database, queries are used. Queries are defined within Global Definitions or Local Definitions. We can distinguish three kinds of queries in LION programming:

 

Resolving deadlocks

The simplest example of a deadlock situation is when process-A waits for data that is locked by process-B, but process-B will only unlock the data when it receives data from process-A. Process-A will however only unlock the requested data after it has been given the data that is locked by process-B. This means that these two processes will wait forever for the data they requested.

The chances of a deadlock situation occurring can be decreased by:

In case of a deadlock situation, the process that is subject to a deadlock situation and is elected by the database server is stopped. By stopping the process, its resources become free for other processes. Because of that, other processes can use these resources to complete their tasks and give back their own resources, which possibly leads to a successful transaction of the stopped process when it is restarted.

Normally when two processes try to lock the same record, the process that comes second will fail with a deadlock error. When using an MSSQL Database server and the processes are started from the Task Object in the code or from a Job Script using the Comscript Job Object, a property DEADLOCKPRIORITY can be set to a value ranging from -10 to 10. When the DEADLOCKPRIORITY properties set for both processes differ, the process with the lowest DEADLOCKPRIORITY value will fail, even when it was the first to lock the record (See the ComScript Job Interface).

If a report makes use of SAVERECOVERYNAME, and it is elected for termination due to a deadlock situation, then the report will be automatically restarted (5 attempts at most). In all other cases, the restarting of the processes (whether a screen or report) must be done by the end-user or administrator.


For more information about the resolving of deadlock situations, see also the documentation for your database management software.

In case of a deadlock situation a bugreport containing information about the deadlock will be written to the application log folder.

Note: The bugreport will only be created when the user account the application uses to log on to the database has VIEW SERVER STATE rights on the database server, otherwise an error message will be created stating the lack of rights on the database server.