user2324551
user2324551

Reputation: 21

SSIS 2012 Dynamic OLE DB ConnectionString using a parameter

I have a project which I will need to deploy to servers not in our network and thus will not know certain attributes such as the server and database names. So I set up a parameter in the "Project.params" area. In this string parameter I placed: "Data Source=" + @[$Project::ServerName] + ";User ID=" + @[$Project::UserName] + ";Initial Catalog=" + @[$Project::InitialCatalog]; + "Provider=SQLNCLI11.1;Persist Security Info=True;" I copied the connection from the original one I set up before attempting this.

When I set the project level OLEDB Connection manager to this parameter in an expression (for the connection string), I get the string just as I typed and not the values of the other parameters. In other words when evaluated the expression appears just as above. Doing so invalidates all of the components in the package which use the connection. Any ideas on what I am doing wrong? Thank you in advance.

Upvotes: 2

Views: 3331

Answers (2)

Ajay Meda
Ajay Meda

Reputation: 378

Your connection string is missing the password field. I faced the same problem and adding the Password field that references to a variable/parameter fixed the problem for me. Also make sure the DelayValidation property is set to "True" for the Connection Manager.

Upvotes: 0

Steve Jones
Steve Jones

Reputation: 41

You cannot use multiple Project Parameters in a single parameterized OLE DB connection manager. Also, you cannot create a Project Parameter that dynamically builds on other Project Parameters, as they are read-only within a script task.

You would need to use a local (package-level) connection manager that uses a variable for its connection string. That local variable can be build on project parameter values.

Also see this post for a similar scenario: Expression Builder of Connection Manager not showing Variables

Upvotes: 2

Related Questions