I stored my connection string values in my application settings in my .NET project. The values are passed to the package programmatically, and can be configured to point to any source or destination.
Here is some code I recently slapped together to do this:
Dim pkg As New Package
Dim app As New Microsoft.SqlServer.Dts.Runtime.Application
Dim pkgResults As DTSExecResult
Dim eventListener As New EventListener()
Try
'create SSIS variables for dynamic parameters, retrieved from the appSettings in the [app.config] file
Dim SSISPackagePassword As String = ConfigurationManager.AppSettings.Item("SSISPackagePassword")
Dim SSISImportPackagePath As String = ConfigurationManager.AppSettings.Item("SSISImportPackagePath")
Dim SSISImportPackageServerName As String = ConfigurationManager.AppSettings.Item("SSISImportPackageServerName")
Dim SSISImportPackageServerUserName As String = ConfigurationManager.AppSettings.Item("SSISImportPackageServerUserName")
Dim SSISImportPackageServerPassword As String = ConfigurationManager.AppSettings.Item("SSISImportPackageServerPassword")
Dim SSISImportPackageDestinationDBName As String = ConfigurationManager.AppSettings.Item("SSISImportPackageDestinationDBName")
'set package password
app.PackagePassword = SSISPackagePassword
pkg.PackagePassword = SSISPackagePassword
'Load SSIS package
pkg = app.LoadFromSqlServer(SSISImportPackagePath, SSISImportPackageServerName, SSISImportPackageServerUserName, SSISImportPackageServerPassword, eventListener)
'set the package-level variable to supply the Access DB's (SSIS source) file path
pkg.Variables("sourceDatabasePath").Value = databasePath
'Dynamic SQL connection string values
pkg.Variables("destinationDatabaseLocation").Value = SSISImportPackageServerName
pkg.Variables("destinationDBUserID").Value = SSISImportPackageServerUserName
pkg.Variables("destinationDBName").Value = SSISImportPackageDestinationDBName
pkg.Variables("destinationDBPassword").Value = SSISImportPackageServerPassword
'Execute the Import SSIS package, add an eventListener object for SSIS reflection
pkgResults = pkg.Execute(Nothing, Nothing, eventListener, Nothing, Nothing)
'Package execution results
Select Case pkgResults
Case DTSExecResult.Completion
MsgBox("Data import completed!")
Case DTSExecResult.Success
MsgBox("Data import was successful!")
Case DTSExecResult.Failure
MsgBox("Data import was not successful!")
End Select
Catch ex As Exception
MsgBox(ex.Message)
End Try
My biggest advice on doing this, is to create your package first with a hardcoded connection string value. Once your package is tested, completed, verified, then remove the connection string, rewrite it with a regular expression using the variables defined as parameters to your package.
The big downside to this is when you need to modify a package. Since the connection is dynamic it loses track of metadata, mappings and the IDE just gets very unhappy, fast. I have not found a solution to this (maybe I could be overlooking something?). Once you've reverted the connection strings to hardcoded sources, you can fix your package from there. Of course you have to later re-add your dynamic settings again (so I always save them in a text file, because regular expressions arent fun to re-write over and over). P.S. Sorry this is in vb :( seriously...
Good luck, may the force be with you.