Setting the Connection String in a Package from a Variable

gravatar

Paul S. Waters

This snippet shows how to set the connection string of a connection referenced from a package with a package variable. The package variable is set from the parent package.

published 11.20.13

last updated 11.20.13


Share

Tags

  • Parent Package Configuration
                            


<Biml xmlns="http://schemas.varigence.com/biml.xsd"> 
    <Connections>
        <Connection Name="SourceConn" ConnectionString="Data Source=(local);Initial Catalog=SourceDb;Provider=SQLNCLI10.1;Integrated Security=SSPI;Auto Translate=False;" />
    </Connections>
	<Packages>
		<Package Name="Load SorceTable" ConstraintMode="Linear" PackageSubpath="Staging_ETL" >	
            <Variables>
               <Variable Name="DataSourceConnectionString" DataType="String" InheritFromPackageParentConfigurationString="DataSourceConnectionString"></Variable>
            </Variables>
            <Connections>
				<Connection ConnectionName="SourceConn">
					<Expressions>
						<Expression PropertyName="SourceConn.ConnectionString">@[User::DataSourceConnectionString] </Expression>
                    </Expressions>
                </Connection>
            </Connections>
		</Package>
	</Packages>
</Biml>
                        

This snippet shows how to set the connection string of a connection referenced from a package with a package variable. The package variable is set from the parent package. Notice that the connection is declared under the Biml root node, and the connection string is set in the Connections node inside the Package node.

You are not authorized to comment. A verification email has been sent to your email address. Please verify your account.

Comments

There are no comments yet.