Concurrency problem

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
samuel

Concurrency problem

Post by samuel » Fri 20 May 2005 09:39

Dear all,

Could anyone tell me how to make concurrent database application using ODAC?

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Mon 23 May 2005 13:38

It is hard to find out your exact need, if you mean multitier application then you can use our ProxySession demo, if it's a multithread application - Threads demo, in other case we need more detailed description of your problem.

Samuel

Post by Samuel » Sat 18 Jun 2005 05:04

My problem is like this: My application will select and update the Oracle DB using ODAC. Many user can use my application at the same time. If two user edit the same record in the same time, there will be a conflict. How can I avoid this.

ThomasB
Posts: 6
Joined: Tue 09 Nov 2004 13:50
Location: Hannover, Germany

Post by ThomasB » Mon 20 Jun 2005 13:14

It depends totally on what you want to achieve. Get the books from Thomas Kyte, there is much info about this. Understand the concept of consistent reads.

Generally, if you want to avoid concurrent editing, your application has to open the data with FOR UPDATE NOWAIT. If another user tries to open the same data, he gets an ORA-00054. You can catch the error and convert it into a meaningful error message. Without the NOWAIT, the second session waits until the first transaction commits or rollbacks. If this lasts long, the second user may see the application "hang".

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Tue 21 Jun 2005 07:41

Take a look at "TOraDataSet.Lock" , "TOraDataSet.LockMode" and "TCustomOraQuery.SQLLock" ODAC help topics.

Post Reply