Subject | Concurrent updates fail |
---|---|
Author | Rajesh Punjabi |
Post date | 2003-09-20T12:31:37Z |
I am trying a simple concurrent update which is not performing the way
say Oracle is in the same situation.
The settings are:
Firebird ver 1.5 rc3 running on Win 2K pro
Using the JBird 1.0.1 driver available on sourceforge.net
The scenario is as follows:
User A : 'Update temptable set idd=11 where name ='bar'
Executes
User B : 'Update temptable set idd=12 where name ='bar'
Executes
B waits for A to finish.
When A does commit B gets exception. Now B has a try except loop that
retries the same query but the exception repeats.
Here lies the problem ... I want that B should be permitted no matter
what happenned to what A did. B changed record later in time and must be
allowed (that is my business logic). However if B tries the same
statement again he again gets the same exception untill I do a rollback
or commit. The problem is that B is doing this update as a part of a
larger transaction and my control is lost here if I commit or rollback.
Oracle for example allows me to do this ... coz the context has changed.
After the commit by A, B is now in a different transaction and should be
allowed the update. B does not even need to know whether anyone else has
altered the record. His changes have to be accepted. That is the
business logic requirement.
Is this a problem with Firebird or the driver ? Does Firebird allow this
or do I need a different driver or are there some parameters on client
side that I am getting wrong.
Regards,
RP
say Oracle is in the same situation.
The settings are:
Firebird ver 1.5 rc3 running on Win 2K pro
Using the JBird 1.0.1 driver available on sourceforge.net
The scenario is as follows:
User A : 'Update temptable set idd=11 where name ='bar'
Executes
User B : 'Update temptable set idd=12 where name ='bar'
Executes
B waits for A to finish.
When A does commit B gets exception. Now B has a try except loop that
retries the same query but the exception repeats.
Here lies the problem ... I want that B should be permitted no matter
what happenned to what A did. B changed record later in time and must be
allowed (that is my business logic). However if B tries the same
statement again he again gets the same exception untill I do a rollback
or commit. The problem is that B is doing this update as a part of a
larger transaction and my control is lost here if I commit or rollback.
Oracle for example allows me to do this ... coz the context has changed.
After the commit by A, B is now in a different transaction and should be
allowed the update. B does not even need to know whether anyone else has
altered the record. His changes have to be accepted. That is the
business logic requirement.
Is this a problem with Firebird or the driver ? Does Firebird allow this
or do I need a different driver or are there some parameters on client
side that I am getting wrong.
Regards,
RP