简体   繁体   English

SqlConnectionStringBuilder 在 SSIS 包中失败

[英]SqlConnectionStringBuilder Failing within SSIS package

I have a couple of SSIS packages in Production that are using the SqlConnectionStringBuilder to connect to the SQL Server database.我在生产中有几个 SSIS 包,它们使用 SqlConnectionStringBuilder 连接到 SQL Server 数据库。 These packages were working fine till about 10 days ago and we did not change anything on Prod.这些包在大约 10 天前运行良好,我们没有对 Prod 进行任何更改。 Then, all of a sudden, the package started failing with the error being然后,突然之间,包开始失败,错误是

The connection string format is not valid.连接字符串格式无效。 It must consist of one or more components of the form x=y separated by semicolons.它必须由一个或多个由分号分隔的 x=y 形式的组件组成。

When I try to debug the script task, the script task always fails at the following:当我尝试调试脚本任务时,脚本任务总是在以下情况下失败:

string connstring = Dts.Variables["User::Static"].GetSensitiveValue().ToString();
//MessageBox.Show(connstring);
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(connstring);
builder.ConnectTimeout = 1800;

From the error message it seems I am passing a blank connection string, but that is not the case.从错误消息看来,我传递了一个空白的连接字符串,但事实并非如此。 I have hard coded the connection string to the Static variable so that it does not dynamically build (obviously for test and resolution purposes).我已将连接字符串硬编码为静态变量,以便它不会动态构建(显然是为了测试和解析目的)。

What are my alternatives to this method and what else can I do to troubleshoot this issue?这种方法有什么替代方法,我还能做些什么来解决这个问题? Any help is appreciated.任何帮助表示赞赏。

EDIT:编辑:

Upon digging further, I get to the point where it is trying to execute the Stored proc on the database.进一步挖掘后,我到了它试图在数据库上执行存储过程的地步。

SqlCommand command = new SqlCommand("[dbo].[GetdataALL]", sqlConn);
                    command.CommandTimeout = 1800;
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@Columns1", Dts.Variables["User::Columns"].Value.ToString());
                    command.Parameters.AddWithValue("@Where_ID", Dts.Variables["User::WhereID"].Value.ToString());
                    command.ExecuteNonQuery();

What would be a probable cause of the failure?失败的可能原因是什么? Thank you.谢谢你。

Are you getting this error only when debugging?您是否仅在调试时收到此错误? If so, you need to change the protection level to EncryptSensitiveWithPassword.如果是这样,您需要将保护级别更改为 EncryptSensitiveWithPassword。 Check HodgyHodson's answer.检查 HodgyHodson 的回答。

Refer this link 参考这个链接

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

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