DBLoader and transactions on SQL Server

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Licences AAW
Posts: 10
Joined: Tue 21 Jul 2015 07:43

DBLoader and transactions on SQL Server

Post by Licences AAW » Tue 08 Dec 2015 12:44

[Unidac 6.1.5]

Hello,

as continuation of this thread, I'm facing a new problem.
So, then I use 2 dbloaders to insert data in the table: one with DefaultFields with a specific value I want in the recordset, and an other without DefaultFields to let the server apply the DEFAULT constraints.

But, if the second dbloader produce an error because of a field value not matching database constraint (DEFAULT one or any other), I would have the first dbloader being reverted.

As it seems the DBLoader is not allowed to use a transaction with SQL Server, I can't find a way to "cancel" the first dbloader.
I tried to use a global transaction on the connection, but DBLoader doesn't allow this to.

So, I'm looking for something (a trick, an official property/code) to be able to "cancel" a loader action.
Is it even possible?

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: DBLoader and transactions on SQL Server

Post by azyk » Fri 11 Dec 2015 13:11

When you use TUniLoader for SQL Server, it uses the IRowsetFastLoad.InsertRow method to add rows to the bulk copy rowset. When all records are inserted, TUniLoader calls the IRowsetFastLoad.Commit method to write the rows to the SQL Server table. We will investigate the possibility to change this behavior and inform you about the result.

Post Reply