Friday, December 13, 2013

Configuring a package using dtsconfig configuration files

Had someone ask me a question on how to configure a package using DTS Config files, since they had only had experience configuring using sysdtsconfig.
Open the package.
Right click and choose package configurations.
Click on “Add”
Click “Next”

Make sure “XML configuration file” is selected in the configuration type drop down.
Then select “Browse”
Then browse out to the dtsconfig file

You should get something like:

You will say “reuse existing” unless you are adding or CHANGING a configuration in the file.
IF you are just trying to GET a configuration from the file, then you just want to Reuse existing, and not change the file in ANY way.

If you want to ADD a configuration, but not CHANGE an old configuration, you still want to use “Reuse existing”

IF you want to overwrite existing configurations, as well as change/add configurations, then you use “Overwrite”
Now give your configuration a useful name, hopefully a standard within your company.
Now that you have added the configuration:
Select it, and hit Edit, and verify that it configures the elements you care about.
In this example, I am configuring the connection string of the ETLExamples object.
The file looks like:
<?xml version="1.0"?>
<DTSConfiguration>
   <DTSConfigurationHeading>
       <DTSConfigurationFileInfo GeneratedBy="TheMythTheManTheLegend" GeneratedFromPackageName="ExampleUsingDTSConfigurationFiles" GeneratedFromPackageID="{CD0DB029-8B6D-4994-B8C5-D0DE51A611A4}" GeneratedDate="12/13/2013 2:54:52 PM"/>
   </DTSConfigurationHeading>
   <Configuration ConfiguredType="Property" Path="\Package.Connections[ETLExamples].Properties[ConnectionString]" ValueType="String">
       <ConfiguredValue>Data Source=.;Initial Catalog=ETLExamples;Provider=SQLNCLI10.1;Integrated Security=SSPI;Application Name=SSIS-ExampleSimpleCSVExport-{B3A912D4-3037-43F8-AE78-511D48B8BC26}LocalHost.ETLExamples;Auto Translate=False;</ConfiguredValue>
   </Configuration>
</DTSConfiguration>

As you can see, the “Path” has the exact name of my connection to configure (ETLExamples) sand the property (connectionstring) because it looks like this, when I hit edit, my edit screen will look like:
If it does not show this, it means that the name is not the same in your package.  If you are trying to use a common connection value, then you must name your package items (such as connections, or whatever you want to configure) the same name of the thing being configured in this file.
Calling your connection “MyETLExample” and expecting it to be configured, or expecting to easily match configurations or select it from the file simply would not be valid in this case.


No comments:

Post a Comment