Re: Locking
Posted in 1996
Reijer Koopsen wrote: > > I'm using informix online dynamic database server. > > On the client side, odbc met visual basic. > Odbc driver 2.10 from Intersolv. > > Problem: > > I want to lock a row exclusive ! > > If I get a row with the select for update statement > I want that every other connection gets an error message > when the select the same row for update, not read only. > > The only way I get the desired behaviour is if I lock the > table with the lock table statement, but then an other process > can not even read the row. > > Please help.... This is exactly what I had done in my VB application. In order to lock a row exclusively, you may do the following: 1. Set table lock mode to row level locking; 2. In VB application you start transaction, "begin work", like: rdoConnection.execute "begin work" if you use VB 4.0 EE RDO method; 3. Do a dummy update of the row you want to lock, e.g., rdoConnection.execute "update yourtabel set column=knownvalue where column=knownvalue"; 4. This row will be locked until you commit work or rollback work. This has been working fine for the locking purpose. When other user tries to access this row, they will get "record locked" message. HTH Weimin Yang Aerotek Inc.