Hi Ralf,

The problem is the Autocommit Mode. 
You should turn it off because the commit removes the locks.

HTH.

Regrads Holger

> -----Original Message-----
> From: Ralf Schneider [mailto:[EMAIL PROTECTED]]
> Sent: Donnerstag, 14. M�rz 2002 11:13
> To: Yves Trudeau; [EMAIL PROTECTED]
> Subject: Re: Locking at application level
> 
> 
> Am Montag, 11. M�rz 2002 16:20 schrieb Yves Trudeau:
> > Hi,
> >     With a MS Access 97 application we use the Sapdb "Lock" 
> statement in
> > transactions to manage concurrent access to the data. We 
> use statements
> > like:
> >
> > "LOCK (WAIT) ROW TbParam KEY Descrip = 'InvoiceNo' IN 
> EXCLUSIVE MODE"
> >
> > In this example, the field Descrip is the primary key of 
> the table TbParam.
> > If you replace (WAIT) with (NOWAIT), the statement will not 
> block and will
> > return an error message allowing you to detect a lock 
> issued by someone
> > else. We have also chosen to work at the "uncommitted" 
> isolation level
> > mainly because of the MS Access behavior with locks. With 
> our application,
> > if Access crash (our dear old friend Dr. Watson...) the 
> connection to the
> > database is released along with the lock.
> 
> Hi,
> 
> I tried this but it didn't work for my application. Perhaps, 
> I have not 
> understood erverything correct.
> 
> This is what I tried:
> 1. The user selects an Item in a tree view (entries are companies)
> 2. I determine if he want to edit or view the selected company.
> 3. If he wants to edit, I lock the company with the following 
> statement:
>     LOCK (NOWAIT) ROW company KEY "cid" = 12 IN EXCLUSIVE MODE
> 4. Then I load the data of this company, so that the user can edit it.
> 5. When the user selects another company in the tree, I 
> unlock the last one.
> 
> After that, I expected that a second user who opens the same 
> company for 
> editing would get an error, but this didn't happen.
> 
> Where can I find the locks in the database? I guessed in 
> table LOCK, but 
> there is no entry after executing the LOCK-statement.
> 
> Some additional info:
> - I use the ODBC driver under Linux to connect to the database.
> - The SQL statement is executed via SQLExecDirect().
> - The isolation level and the commit mode is on default 
> values (I guess       
> isolation level 0 and AutoCommit On, is that right?)
> 
> What am I missing? I hope anybody could help me to solve this problem.
> 
> Thanks in advance,
> Ralf.
> -- 
> ##     Ralf Schneider
>  ##     B-connected Linux Solutions GmbH  -  Linux f�r den Mittelstand
>   ##     Dennis-Gabor-Str. 2, 14469 Potsdam
>    ##     www.b-connected.de
> _______________________________________________
> sapdb.general mailing list
> [EMAIL PROTECTED]
> http://listserv.sap.com/mailman/listinfo/sapdb.general
> 
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to