Borland®
Shop
Products Downloads Services Support Partners News & Events Company Community
Company

 SQL LINKS DEVELOPER SUPPORT

SEARCH Borland Online/Developer Support

Tech Notes Index


MSSQL deadlock detection, BDE/SQL Links transactions, 1205, 10255
Date:	5/30/97 6:31pm

[*Please note that the behavior of the MSSQL SQL Links driver v4.01 and
 above has been changed to automatically reset the transaction state if a 
 1205 error is encountered]

Problem:
Some MS SQL Server operations cause the server to rollback the 
current transaction. If this occurs within an explicit transaction, 
the BDE transaction state is no longer in sync with the server.  
A database.rollback or commit will cause a SQL Error:
'No user transaction is currently in progress.  The rollback transaction 
request has no corresponding BEGIN TRANSACTION.'  

At this point the server has returned the server error code:
'1205' which is raised by the BDE.  

The BDE will in turn raise the error:
'10255 : A deadlock was detected.'

A database.startTransaction will cause the BDE error, 
'A user transaction is already in progress.'

Resolution:
3 possible workarounds.
1) Set DB/ALIAS SQL PASSTHRU MODE param to "NOT SHARED"
2) Close and re-open the database that is out of sync.
3) execute a tquery that starts a transaction on the server and 
then issue a database.rollback (?).

try
  database1.startTransaction;
  //do something that causes a server error
except
  //Check to see if the error caused the transaction to rollback on the server.
  //If yes, start a transaction on the server.
  //qBeginTrans SQL String = if @@TranCount=0  begin transaction
  qBeginTrans.execSQL;    

  //Rollback BDE and server transaction.
  database1.rollback;
end;


PUB
MSSQL WIN32 LINK ERROR 
BC, CJ, SA
5.30.97 [update 1.1.98]



 
Site Map Search Contact