Page 1 of 1

Transaction trouble

Posted: Mon 13 Apr 2020 03:21
by Tsagoth
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.

Re: Transaction trouble

Posted: Tue 14 Apr 2020 12:32
by oleg0k
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