简体   繁体   中英

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. These packages were working fine till about 10 days ago and we did not change anything on 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.

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. Check HodgyHodson's answer.

Refer this link

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