Subject Re: FireBird locks
Author chris_delphi
>>chris_delphi wrote:
>> 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
lock
>> each other, when both try to access the same row in the same table
in
>> the database at the same time. The only clues we have is that the
lock
>> always lasts exactly sixty seconds and it does not appear to be a
time
>> out we have set in any of the programmes we have written. We can
get
>> it to lock when both programmes have performed a select statement
so
>> it appears that it's not the write operations in the server that
are
>> causing the problem.
>>
>> Long version
>> [snip] see the previous post for this it contains the version
numbers of the
>> components etc.
>>
>> Chris Barrington
>>
>
>What is your CursorType and LockType when specifying a recordset.
open?
>I have adOpenStatic and adLockReadOnly and it seems to work just
fine.

>Jason


Thanks 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