簡體   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