S
suntisuka
I create a program to test locking machanism. I use ADO 2.8 to update JET
database 4.0. I also use Server cursor, Pessimistic Locking and Transaction
control. My test is simple, just increase a filed value by 1. This is the
step I tested
Process 1 : Open Connection
Process 1 : Begin Transaction
Process 1 : Read Record , I got 29
Process 2 : Open Connection
Process 2 : Begin Transaction
Process 2 : Read Record , I got 29 also
Process 1 : Increase value by 1
Process 1 : Update Record
Process 1 : Comit Transaction, Now it is 30
Process 2 : Increase value by 1
Process 2 : Update Record <==== Remark A
Process 2 : Comit Transaction, It also 30 <=== I wondor here !
What I wonder is the last step should error since data (29) was changed
before process 2 updates it but it does not. Do I miss something or How to
control to make it the last step error ?
If I change to optimistick locking, Process 2 works well. Error "3197 : The
Microsoft Jet database engine stopped the process because you and another use
are attempting to change the same data at the same time." is generated on
"Remark A" line as I expect.
Thanks for any help
database 4.0. I also use Server cursor, Pessimistic Locking and Transaction
control. My test is simple, just increase a filed value by 1. This is the
step I tested
Process 1 : Open Connection
Process 1 : Begin Transaction
Process 1 : Read Record , I got 29
Process 2 : Open Connection
Process 2 : Begin Transaction
Process 2 : Read Record , I got 29 also
Process 1 : Increase value by 1
Process 1 : Update Record
Process 1 : Comit Transaction, Now it is 30
Process 2 : Increase value by 1
Process 2 : Update Record <==== Remark A
Process 2 : Comit Transaction, It also 30 <=== I wondor here !
What I wonder is the last step should error since data (29) was changed
before process 2 updates it but it does not. Do I miss something or How to
control to make it the last step error ?
If I change to optimistick locking, Process 2 works well. Error "3197 : The
Microsoft Jet database engine stopped the process because you and another use
are attempting to change the same data at the same time." is generated on
"Remark A" line as I expect.
Thanks for any help