A
A
Anton Ivanov2020-05-07 12:31:35
Microsoft Access
Anton Ivanov, 2020-05-07 12:31:35

How to force Microsoft Access to use the same session for queries?

The customer has a large application in Access.
The data was transferred to SQL Server, in Access, respectively, made linked tables (via DSN-less ODBC Connection String).

The problem is that when an application encounters this code:

BeginTran
db.Execute("update ....... ") '  изменение каких-то данных (#запрос1)
db.CreateRecordset("select * ....") ' чтение этих же, только что измененных данных (#запрос2)


the request falls with timeout exceeded. I looked at active queries through the SQL Server Management Console, I see that #request1 started a transaction in a session with id (let's say) 55, and #request2 is executed in a session with a different id (and also started a transaction there)

Due to the fact that in SQL Server isolation level is READ COMMITTED by default, it is logical that the second request is waiting for the completion of the transaction in the first, and the code in Access is waiting for the completion of the second request, which, as a result, is interrupted by a timeout.

I tried to rewrite queries in ADO, you can specify the isolation level there and do many other tasty things, but then you need to change the queries, which are all written under the Jet Engine ...

Perhaps there is some more correct solution? For example, somehow explicitly indicate that all requests in "this transaction" must be performed in one session?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question