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.