繁体   English   中英

无法通过IntegrationServices连接到服务器

[英]Can't Connect to Server via IntegrationServices

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

我在行上得到“无法连接到服务器BSQL_01”的一般错误:

IntegrationServices ssisServer = new IntegrationServices(ssisConnection);

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

在此输入图像描述

这是我遇到问题的代码。

// 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',我不再收到错误。 它出现在我获得“成功”时,但是,当我检查应该填充的表时,没有任何东西存在。

ConnectionString的“初始目录”需要是“主”,而不是“SSISDB”

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM