无法通过 IntegrationServices 连接到服务器 [英] Can't Connect to Server via IntegrationServices

查看:58
本文介绍了无法通过 IntegrationServices 连接到服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试连接到我的 SQL Server 以运行 SSIS 包.我承认这是我第一次尝试这个,所以我并不完全相信我的一切都是正确的.

I am trying to connect to my SQL Server to run a SSIS package. I admit that this is the first time I've tried this, so I'm not exactly confident that I have everything correct.

我在线上收到无法连接到服务器 BSQL_01"的一般错误:

I get a generic error of "Failed to connect to server BSQL_01" on the line:

IntegrationServices ssisServer = new IntegrationServices(ssisConnection);

这是我的 SQL Server,唯一的包是我正在尝试运行的包:

Here is my SQL Server, and the only package there is the one I'm trying to run:

这是我遇到问题的代码.

Here is the code I'm having issues with.

// Connection to the database server where the packages are located
SqlConnection ssisConnection = new SqlConnection("Data Source=BSQL_01;Initial Catalog=master;Integrated Security=SSPI;");

// SSIS server object with connection
IntegrationServices ssisServer = new IntegrationServices(ssisConnection);

// The reference to the package which you want to execute
PackageInfo ssisPackage = ssisServer.Catalogs["SSISDB"].Folders["PORGImport"].Projects["PORGImport"].Packages["PORGImport.dtsx"];

long executionIdentifier = ssisPackage.Execute(false, null, executionParameter);

ExecutionOperation executionOperation = ssisServer.Catalogs["SSISDB"].Executions[executionIdentifier];

while (!executionOperation.Completed) {
    System.Threading.Thread.Sleep(5000);
    executionOperation.Refresh();
}

if (executionOperation.Status == Operation.ServerOperationStatus.Success) {
    Console.WriteLine("Success");
    MessageBox.Show("Success");

} else if (executionOperation.Status == Operation.ServerOperationStatus.Failed) {
    Console.WriteLine("Failed");
    MessageBox.Show("Failed");

} else {
    Console.WriteLine("Something Went Really Wrong");
    MessageBox.Show("Oh Crap");
}

更新

好的,我将 ConnectionString 中的初始目录更改为Mmaster",并且不再出现错误.它似乎在我获得成功"时运行,但是,当我检查应该填充的表时,什么都没有.

Ok, I changed the Initial Catalog in my ConnectionString to 'Mmaster' and I no longer get the error. It APPEARS to run as I get the "Success", however, when I check the tables that are supposed to be populated, nothing is there.

推荐答案

ConnectionString 的Initial Catalog"需要是master",而不是SSISDB"

The "Initial Catalog" of the ConnectionString needed to be "master", not "SSISDB"

SqlConnection ssisConnection = new SqlConnection("Data Source=BSQL_01;Initial Catalog=master;Integrated Security=SSPI;");

这篇关于无法通过 IntegrationServices 连接到服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆