简体   繁体   中英

Can't Connect to Server via IntegrationServices

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.

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

IntegrationServices ssisServer = new IntegrationServices(ssisConnection);

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");
}

Update

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的“初始目录”需要是“主”,而不是“SSISDB”

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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