c# - 无法通过 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;");
推荐阅读
- mysql - 如何在 laravel 中获取用户的类型?
- wordpress - 图标在 WordPress 的“添加新帖子”页面中不起作用
- c++ - 为动态分配的整数赋值
- python - 通过终端使用 import os 命令会出错
- python - 从pytorch中的张量选择性替换向量的有效方法
- python - 解析字典的 JSON 列表
- yii2 - 使用 Yii2 ActiveRecord 在 SELECT 中带有大小写的子查询
- arrays - Angular - 如何根据选择中的选项更改从 JSONA 下载的数据
- javascript - 如何在对象中合并对象的属性
- angular - ./node_modules/@syncfusion/ej2-angular-richtexteditor/@syncfusion/ej2-angular-richtexteditor.es5.js 在构建角度应用程序期间出错