Turn: handling of MSDTC Distributed exceptions in the record set returned by the remote SP for SQL cross-origin calls

Source: Internet
Author: User

1) For MSDTC exceptions, the general solution is as follows,

First, make sure that the DTC is available in Control Panel-add or delete programs-Add/delete Windows Components-application server.

Step 1: for the two servers in different domains, update C: "Windows" System32 "drivers" etc "hosts and add the IP address of the other server, computer name.

Step 2: Click the menu to go to the running options and enter 'dcomcnfg'. The following interface is displayed.

Step 3: select the red area.


Step 4: Perform Security Configuration

Step 5: Click OK. The system automatically restarts services such as MSDTC and SQL Server.

 

Ii) records set of remote SP calls by SQL, without MSDTC

Bytes --------------------------------------------------------------------------------------------------------
--- Prerequisites: Create a linked server
Exec sp_addmediaserver 'srv _ lnk ', '', 'sqlodb', 'remote server name or IP address'
Exec sp_add1_srvlogin 'srv _ lnk ', 'false', null, 'username', 'Password'
Exec sp_serveroption 'srv _ lnk ', 'rpc out', 'true' -- this allows you to call stored procedures on the linked server.

Bytes --------------------------------------------------------------------------------------------------------
--- Method 1
------ Truncate/create/Insert table at remote server
Declare @ iSQL nvarchar (300)
If exists (select * from [172.26.16.4]. smtother. DBO. sysobjects where name = n' _ tempcheckresult' and type = n' U ')
Begin
Set @ iSQL = n' truncate table _ tempcheckresult'
Exec [172.26.16.4]. smtother. DBO. sp_executesql @ iSQL
End
Else
Begin
Set @ iSQL = n' create table _ tempcheckresult (iresult varchar (50 ))'
Exec [172.26.16.4]. smtother. DBO. sp_executesql @ iSQL
End

Set @ iSQL = n' insert into _ tempcheckresult exec [copypackingsnform2checkbysn] '+ ''' + 'w88410320.5vsa' + ''''
Exec [172.26.16.4]. smtother. DBO. sp_executesql @ iSQL

Select * from [172.26.16.4]. smtother. DBO. _ tempcheckresult

Bytes ---------------------------------------------------------------------------------------------------------------
--- Method 2
------ Truncate/create/Insert table at remote server for sql2005
Declare @ iSQL nvarchar (300)
If exists (select * from [172.26.16.4]. smtother. DBO. sysobjects where name = '_ tempcheckresult' and type = n' U ')
Begin
Set @ iSQL = n' truncate table smtother. DBO. _ tempcheckresult'
Execute (@ iSQL) at [172.26.16.4]
End
Else
Begin
Set @ iSQL = n' create table smtother. DBO. _ tempcheckresult (iresult varchar (50 ))'
Execute (@ iSQL) at [172.26.16.4]
End

Set @ iSQL = n' insert into smtother. DBO. _ tempcheckresult exec smtother. DBO. [copypackingsnform2checkbysn] '+ ''' + 'w8841031_5vsa' + ''''
Execute (@ iSQL) at [172.26.16.4]

Select * from [172.26.16.4]. smtother. DBO. _ tempcheckresult

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.