Subject Re: Releasing a locked record
Author Alexander V.Nevsky
--- In firebird-support@yahoogroups.com, "Stevio" <redeagle@f...>
wrote:
> I am using Delphi 5 with Firebird 1 and Interbase Express 5
components.
>
> With my application, I use a simple locking mechanism to lock a
record when
> a user has it open.
>
> Basically:
> - a transaction is started,
> - the record in question is opened using a TIBDataSet,
> - the record is put in edit mode,
> - the id value for the record is set to itself.
> - the change is posted.
> - the TIBDataSet is closed.
> - the transaction is not committed however until the user makes
their
> changes to the data and clicks OK.
>
> My problem is that the system is hanging occasionally for some
reason (not
> sure why), and when they CTRL ALT DEL to close it and restart it,
records
> are being left locked for weeks at a time. (I'm not sure how they
are
> eventually released - perhaps if the server is rebooted they get
released
> then?)
>
> How can I manually release the lock, or override the lock, on a
record when
> I have no access to the original transaction?

Stephen, if it was true, no one of us could'nt use FB. Records are
locked not by "dead" connections, but by live ones. You reap the
fruits of your superfluos enthusiasm to pessimistic locking - you are
loosing control on who locked record in complex enough multy-user
system. You can try to decrease influence of "dead" connections
decreasing Connection Timeout Interval configuration parameter, but
better will be to re-design access. Look at
http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_lock_records
about how to avoid pessimistic locking.

Best regards,
Alexander.