问题描述
我正在尝试为使用 VS2012 的单包项目部署设置部署过程.我发现要更改服务器上的动态连接字符串,我可以对连接进行参数化,因此我这样做并创建了环境,并使用具有连接字符串作为参数的环境运行我的包,一切似乎都很好,但是为什么在连接管理器上我仍然可以在开发过程中看到一些旧的设置?我怎样才能删除它?
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 ?
推荐答案
通过参数化,我假设您正在使用配置部分来全局配置项目/包或基于每个执行.这与使用项目/包参数相反
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
我在部署文件夹中创建了一个名为 ConnectionStrings
的 SSIS 环境变量,它有两个值:ServerName 和 CatalogName.
I have created an SSIS Environment variable named ConnectionStrings
in my deployment folder and it has two values: ServerName and CatalogName.
我右键单击了我的项目 DeployMe,然后选择了配置.在您的屏幕截图中,您单击了特定的包并选择了配置.或者您手动更改了 Scope
下拉菜单.
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.
我首先点击 References
并添加一个指向我的环境的指针
I first click on the References
and add a pointer to my Environment
返回Parameters
选项卡,单击连接管理器,然后将CM_Project
连接管理器的ServerName 属性配置为使用环境变量的ServerName 值.清楚对吗?
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?
在配置 ServerName 之后,我还配置了 InitialCatalog
属性,但我没有使用环境变量的值,而是使用了编辑值"选项(上面)来设置它.最终结果是我的属性现在看起来像这样.
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.
- 下划线表示它是从环境变量设置的
- 粗体文本表示它是手动设置的.
现在,当我通过代理或手动执行运行我的包时,它会提示我的第一件事是环境参考.我已经失去了对 InitialCatalog 的粗体,但下划线仍然是 ServerName 属性.尽管如此,两者都是不同的值,如果我执行它,他们会选择正确的值.
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.
说了这么多,我发现只存储整个 ConnectionString 值要容易得多.您将观察到,如果您采用此路线,为 ServerName 显示的值将显示您的设计时值,但这很好,因为 ConnectionString 作为一个整体将在运行时覆盖各个值.
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.
这篇关于SSIS 参数化连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!