Transaction trouble

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Tsagoth
Posts: 33
Joined: Wed 15 Jul 2009 01:25

Transaction trouble

Post by Tsagoth » Mon 13 Apr 2020 03:21

I must be doing something wrong, getting SQL error:


cncMail := TIBCConnection.Create(nil);

cncMail.Server := gIBServer;
--- server stuff here ---

trnMail := TIBCTransaction.Create(nil);
trnMail.DefaultConnection := cncMail;
trnMail.Params.Clear;
trnMail.Params.Add('WRITE');
trnMail.Params.Add('WAIT');
trnMail.Params.Add('READ_COMMITTED');

qryMail := TIBCQuery.Create(nil);
qryMail.Connection := cncMail;
qryMail.LockMode := lmLockImmediate;
qryMail.Transaction := trnMail;

cncMail.Connect;

then later when I have 3 threads running and they are all trying to do like this:

Executing query <UPDATE EMAIL SET LOCKID = '00000003' WHERE LOCKID = '00000000' AND SENT = FALSE ROWS 1>
MailTask: SQL Error: lock conflict on no wait transaction

why is it saying nowait ? I said WAIT in the params. What am I doing wrong ? Also, "READ COMMITTED" is flagged as error, but that is what Interbase API says, you're using different terms.

oleg0k
Devart Team
Posts: 190
Joined: Wed 11 Mar 2020 08:28

Re: Transaction trouble

Post by oleg0k » Tue 14 Apr 2020 12:32

Hello,
To configure transaction parameters manually, you should set the IsolationLevel property of the TIBCTransaction object to iblCustom, in your example:

Code: Select all

trnMail.IsolationLevel := iblCustom;
Refer to the IBDAC documentation for more information about the IsolationLevel property of the TIBCTransaction class in the CHM documentation file or on our website: https://www.devart.com/ibdac/docs/devar ... nlevel.htm

wbr, Oleg
Devart Team

Post Reply