-->

SSIS parametrize connection strings

2019-01-27 08:03发布

问题:

I am trying to set up deployment process for single package usinig project deployment so VS2012. I found that to change dynamicaly connection string on the server I can parametrize connections so I did this and created enviroments and I run my package with inviroment which has connnections strings as parameters and all seems to be fine, but why on connection manager I can still see some old setup made while developing? How can I remove it ?

回答1:

By Parameterize, I assume you're using the Configuration section to globally configure a project/package or on a per-execution basis. This is in contrast to using project/package Parameters

I have created an SSIS Environment variable named ConnectionStrings in my deployment folder and it has two values: ServerName and CatalogName.

I right clicked on my project, DeployMe, and selected Configure. In your screenshot, you have clicked on the specific package and selected Configure. That or you manually changed the Scope drop down.

I first click on the References and add a pointer to my Environment

Back to the Parameters tab, I click over to Connection Managers and I'm going to configure the CM_Project connection manager's ServerName property to use my environment variable's ServerName value. Clear right?

After configuring the ServerName, I also configured the InitialCatalog property but instead of using my Environment Variable's value, I used the "Edit Value" option (above) to set it. The net result is that my properties now look like this.

  1. The underscore indicates it's set from an environment variable
  2. The bold text indicates it's set manually.

Now when I go to run my package, via Agent or manual execution, the first thing it's going to prompt me for is an environment reference. I've lost my bolding for the InitialCatalog but the underlining remains for ServerName property. None-the-less, both are different values and were I to execute it, they would pick up the correct values.

All that said, I find it far easier to just store the whole ConnectionString value. You will observe, if you take this route, that the values displayed for ServerName would show your design-time values but that's fine because the ConnectionString as a whole will override the individual values at run-time.

I know this is a generic answer but I'm hoping I've hit on what you're missing step-wise.