System.AccessViolationException and ADODB.ConnectionClass.CommitTrans

This exception is considered to be unmanaged exception; means exception which we cannot managed, it has to be managed by the providers which is ADODB.

Refer to 'Managed Vs Unmanaged Code'. ADODB is considered unmanaged code.

From my experience, it happened when the database did not have enough resources to do processing, particularly when we have simultaneous read and write operations on the same table.

Actually the database like MSSQL itself has built-in thread concurrency, thus we need not worry about the atomicity of read and write operations on the same table, but it seems like sometimes, exceptions happened.

It is hard to simulate, as you will not know when.

We can only minimize it, and not prevent it. To minimize its occurrences, what we can do is to minimize the possibility of database having limited resources which is to prevent database from being busy while we are performing ADODB.ConnectionClass.CommitTrans

From my experience, the following three strategies proved to greatly reduced the occurrences.
The most practical solution is to restart the application whenever such exception is captured. This is because if we do not restart and continue with database operations, command timeout exception will be expected.

Comments