-- I made local procedure:
create procedure proc_AccountFrom
@.client varchar(50) = null
,@.account varchar(50) = null
,@.amount money = null
as
set nocount on
update client03.Northwind.dbo.ClientAccount
set AccountAmount = AccountAmount - @.amount
where ClientName = @.client and AccountName = @.account
go
-- I also made a procedure on the server:
create procedure proc_AccountTo
@.client varchar(50) = null
,@.account varchar(50) = null
,@.amount money = null
as
set nocount on
update server01.Northwind.dbo.ClientAccount
set AccountAmount = AccountAmount + @.amount
where ClientName = @.client and AccountName = @.account
set nocount off
-- I made the following local procedure:
create procedure proc_AccountTransfer
@.client varchar(50) = null
,@.account varchar(50) = null
,@.amount money = null
as
set nocount on
set ansi_warnings on
set xact_abort on
begin distributed transaction
exec proc_AccountFrom 'Bishoy','Saving',1000
exec server01.Northwind.dbo.proc_AccountTo 'Bishoy','Saving',1000
commit transaction
go
-- The table code:
use northwind
go
CREATE TABLE [dbo].[ClientAccount]
(ClientID int IDENTITY (1,1) NOT NULL
,ClientName varchar (50) NOT NULL
,AccountName varchar (50) NOT NULL
,AccountAmount money NOT NULL
,constraint PK_ClientID primary key clustered (ClientID)
,constraint CK_Amount check (AccountAmount >= 0)
)
go
insert into dbo.ClientAccount values ('Bishoy','Checking',100000)
insert into dbo.ClientAccount values ('Bishoy','Saving',2000)
go
?
\r\n-- But I received the following response:
\r\nServer: Msg 7391, Level 16, State 1, Procedure proc_AccountTransfer, Line 12
The operation could not be performed because the OLE DB provider \'SQLOLEDB\' was unable to begin a distributed transaction. \r\n
[OLE/DB provider returned message: New transaction cannot enlist in the specified transaction coordinator. ]
OLE DB error trace [OLE/DB Provider \'SQLOLEDB\' ITransactionJoin::JoinTransacti on returned 0x8004d00a]. \r\n
?
-- Although:
\r\nThe DTS was active on both servers ?-- ?and they was linked?
\r\n--? and the tables present
\r\n--
Thank you.
Bishoy
-- But I received the following response:
Server: Msg 7391, Level 16, State 1, Procedure proc_AccountTransfer, Line 12
The operation could not be performed because the OLE DB provider 'SQLOLEDB' was unable to begin a distributed transaction.
[OLE/DB provider returned message: New transaction cannot enlist in the specified transaction coordinator. ]
OLE DB error trace [OLE/DB Provider 'SQLOLEDB' ITransactionJoin::JoinTransacti on returned 0x8004d00a].
-- Although:
The DTS was active on both servers -- and they was linked
-- and the tables present
By 'DTS' do you mean 'DTC'? The MSDTC to be precise?First off, make sure that the DTC process is running on both systems. Second, make sure that Network DTC Access is checked on both systems.
Hope that helps.
|||Can have multiple causes, but first check your firewall, you'll have to insert a rule in it (or turn it of :s)
|||Yes, DTC was running on both servers.
But, how to make sure that Network DTC Access is checked on both systems?
No comments:
Post a Comment