Subject | Re: FireBird locks |
---|---|
Author | chris_delphi |
Post date | 2005-11-03T11:22:03Z |
>>chris_delphi wrote:lock
>> Hi.
>>
>> short version
>>
>> We have a (read /write) server which uses IBExpress and a (read
>> only) test client using ODBC via ADO (fbclient.dll) that seem to
>> each other, when both try to access the same row in the same tablein
>> the database at the same time. The only clues we have is that thelock
>> always lasts exactly sixty seconds and it does not appear to be atime
>> out we have set in any of the programmes we have written. We canget
>> it to lock when both programmes have performed a select statementso
>> it appears that it's not the write operations in the server thatare
>> causing the problem.numbers of the
>>
>> Long version
>> [snip] see the previous post for this it contains the version
>> components etc.open?
>>
>> Chris Barrington
>>
>
>What is your CursorType and LockType when specifying a recordset.
>I have adOpenStatic and adLockReadOnly and it seems to work justfine.
>JasonThanks for your reply Jason we've changed the settings to that but we
still get the error.
but I think your on the right path.
We have found a way to simpify and explain the bug though.
Start the server programme
start a transaction
set the params for storedprocedure
call execproc which calls a simple "update xx in table where :i =
primary key" query
now pause the programme on a breakpoint.
(note we have not yet commited the transaction)
Start our client app.
start transaction
call select * from table where primary key = :1
Client app then locks. and will not release until the server does a
commit.
So it looks to us as if our client app is trying to grab a writeable
dataset rather than read only.
n.b. as a test if we run the same query in IB Expert while the server
is paused it will return the dataset and not lock.
our client connection is...
MyADOConnection := TADOConnection.Create(nil);
MyADOConnection.LoginPrompt := False;
MyADOConnection.ConnectionString := 'FILE NAME=D:\MyUDL.udl';
MyADOConnection.IsolationLevel := ilReadCommitted;
MyADOConnection.Connected := True;
MyADOQuery := TADOQuery.Create(nil);
MyADOQuery.LockType := ltReadOnly;
MyADOQuery.ExecuteOptions := [eoAsyncFetchNonBlocking];
MyADOQuery.CursorType := ctStatic;
MyADOQuery.Connection := MyADOConnection;
MyADOQuery.SQL.Text := 'select blah blah....';
MyADOQuery.BeginTrans;
MyADOQuery.Open;
D:\MyUDL.udl contains the following
Provider=MSDASQL.1;Persist Security Info=False;Data Source=MyDatabase;
Mode=Read
has anyone got any further ideas on where we are going wrong ???
Thanks again
Chris Barrington