Discussion:
SSIS Connection not updated programmatically
(too old to reply)
xyz_jat
2008-12-02 17:34:04 UTC
Permalink
I'm trying to modify an existing connection for a package which I call from
another package using a script task. The connection string gets modified but
password does not get modified.

Here is the code I'm using -

Dim pkg As Package() = app.LoadPackage(MyPackageFullPath, Nothing)
Dim pkgConns As Connections = pkg.Connections
Dim ConMgr As ConnectionManager
ConMgr = pkg.Connections("Patrol")
ConMgr.ConnectionString = "Data Source=MyServer;User
ID=MyID;Password=MyPassword;Initial
Catalog=MyDatabase;Provider=SQLOLEDB.1;Persist Security Info=True;"

Server, database, User ID information gets modified but password never gets
updated and results in failure.

Any help is appreciated.
Thanks
Todd C
2008-12-09 13:36:15 UTC
Permalink
SSIS tends to be a little protective of saved passwords.

Why use a script task when you have a built-in task for running a child
package? Just curious.

You may need to pass the ConnectionString (with password) to the child via a
String variable, then set the ConnectionString in the child using an
Expression.

HTH
--
Todd C

[If this response was helpful, please indicate by clicking the appropriate
answer at the bottom]
Post by xyz_jat
I'm trying to modify an existing connection for a package which I call from
another package using a script task. The connection string gets modified but
password does not get modified.
Here is the code I'm using -
Dim pkg As Package() = app.LoadPackage(MyPackageFullPath, Nothing)
Dim pkgConns As Connections = pkg.Connections
Dim ConMgr As ConnectionManager
ConMgr = pkg.Connections("Patrol")
ConMgr.ConnectionString = "Data Source=MyServer;User
ID=MyID;Password=MyPassword;Initial
Catalog=MyDatabase;Provider=SQLOLEDB.1;Persist Security Info=True;"
Server, database, User ID information gets modified but password never gets
updated and results in failure.
Any help is appreciated.
Thanks
xyz_jat
2008-12-09 16:41:01 UTC
Permalink
I have a Master Package with script task which is used to get the list of
packages and parameters from database table and then run the required
packages (the number of packages we need to run varies).

And Master Package is run using a SQL Agent job.
Post by Todd C
SSIS tends to be a little protective of saved passwords.
Why use a script task when you have a built-in task for running a child
package? Just curious.
You may need to pass the ConnectionString (with password) to the child via a
String variable, then set the ConnectionString in the child using an
Expression.
HTH
--
Todd C
[If this response was helpful, please indicate by clicking the appropriate
answer at the bottom]
Post by xyz_jat
I'm trying to modify an existing connection for a package which I call from
another package using a script task. The connection string gets modified but
password does not get modified.
Here is the code I'm using -
Dim pkg As Package() = app.LoadPackage(MyPackageFullPath, Nothing)
Dim ConMgr As ConnectionManager
ConMgr = pkg.Connections("MyConnectionString")
ConMgr.ConnectionString = "Data Source=MyServer;User
ID=MyID;Password=MyPassword;Initial
Catalog=MyDatabase;Provider=SQLOLEDB.1;Persist Security Info=True;"
Server, database, User ID information gets modified but password never gets
updated and results in failure.
Any help is appreciated.
Thanks
Todd C
2008-12-09 17:14:00 UTC
Permalink
Try this:

Use an Execute SQL Task to read the table and load results into a variable
of type: Object. Then have a For Each loop iterate over the records in the
(Object) table, assigning fields in the table to Variables in the package.
Have a single Execute SSIS Package inside the loop. Use its Expressions to
dynamically decide which package to run based on the contents of the
respective variables.

HTH
--
Todd C

[If this response was helpful, please indicate by clicking the appropriate
answer at the bottom]
Post by xyz_jat
I have a Master Package with script task which is used to get the list of
packages and parameters from database table and then run the required
packages (the number of packages we need to run varies).
And Master Package is run using a SQL Agent job.
Post by Todd C
SSIS tends to be a little protective of saved passwords.
Why use a script task when you have a built-in task for running a child
package? Just curious.
You may need to pass the ConnectionString (with password) to the child via a
String variable, then set the ConnectionString in the child using an
Expression.
HTH
--
Todd C
[If this response was helpful, please indicate by clicking the appropriate
answer at the bottom]
Post by xyz_jat
I'm trying to modify an existing connection for a package which I call from
another package using a script task. The connection string gets modified but
password does not get modified.
Here is the code I'm using -
Dim pkg As Package() = app.LoadPackage(MyPackageFullPath, Nothing)
Dim ConMgr As ConnectionManager
ConMgr = pkg.Connections("MyConnectionString")
ConMgr.ConnectionString = "Data Source=MyServer;User
ID=MyID;Password=MyPassword;Initial
Catalog=MyDatabase;Provider=SQLOLEDB.1;Persist Security Info=True;"
Server, database, User ID information gets modified but password never gets
updated and results in failure.
Any help is appreciated.
Thanks
Loading...