Page 1 of 1
Record locking
Posted: Fri Oct 05, 2007 1:58 pm
by driessen
Hello,
Maybe a somewhat strange question.
If a record is locked by RLOCK(), is there any way to know who (which PC or user) locked it ?
Or is there any way to unlock a locked record by someone else ?
Thanks.
Posted: Fri Oct 05, 2007 5:48 pm
by Antonio Linares
Michel,
We have forwarded your question to Przemek who is the RDDs guru.
Lets see what he says
Posted: Fri Oct 05, 2007 6:25 pm
by James Bott
Michel,
>Or is there any way to unlock a locked record by someone else ?
Even if there was, if you did it, you would create a nighmare. If one user had the record locked while editing (pesimistic locking), and another user unlocked it and saved changes, then the first user saved their changes, the second user's changes would be lost.
If you use optimistic locking (only locking during a save) then you won't run into a problem of having a locked record, since it is only locked for a split second.
James
Posted: Fri Oct 05, 2007 7:13 pm
by Antonio Linares
Przemek's answer:
> If a record is locked by RLOCK(), is there any way to know who (which
> PC or
> user) locked it ?
It depends on system which holds the locks. F.e. in Linux you can see all locks using 'lslk' command or by parsing /proc/locks where the 5-th column is PID and 6-th fileid (device and inode).
> Or is there any way to unlock a locked record by someone else ?
> Thanks,
Maybe some systems allow such operation for super user but even if they exist then it's very seldom functionality. It's extremely dangerous operation and may cause data corruption.
best regards,
Przemek
Posted: Fri Oct 05, 2007 7:27 pm
by James Bott
Michel,
Maybe we should ask what you are trying to accomplish? Perhaps there is another way.
James
Posted: Fri Oct 05, 2007 8:55 pm
by Antonio Linares
Michel,
Posted by Brian Hays:
FYI, the ADS remote server does give this functionality (but not local server).
Posted: Fri Oct 05, 2007 11:21 pm
by Rick Lipkin
Michael
If you are on a Novell server there is Novlib ( blinkinc.com ) which has the ability to use the network operating system to tell you 'who' has any file open in a specific folder and who may have it locked exclusively.
Under Windows 2003 ?? I am looking for such a utility myself.
Rick Lipkin
SC Dept of Health, USA
Posted: Sat Oct 06, 2007 2:45 am
by nageswaragunupudi
If using ADS, the management function AdsMgGetLockOwner( ... ) gives this information.
The ADSRDD for (x)Harbour has this function.
Posted: Sat Oct 06, 2007 6:19 pm
by Gale FORd
There is a utility "whohasnt" I use in windows environment. You need a certain level of access rights but it does work. You can also get onto server with remote desktop. Then run the computer management appllication. Then under Shared Folders you will find Open Files. Neither method will not tell you what record is locked, but you can see who has the file open and has at least one lock on that file.
Posted: Sat Oct 06, 2007 10:04 pm
by Rick Lipkin
Gale
You saying 'whohasnt' works on a Windows 2003 server to find who has files open in a certain folder .. I would very much be interested if you would not mind sharing ??
Rick Lipkin
lipkinrm29063@yahoo.com