SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


changing the connection password hrough another package


changing the connection password hrough another package

Author
Message
sas-473105
sas-473105
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 59
I am trying to change the connection password in an existing package through another package,
i am not changing any other properties of the connection like Servername, Userid etc. this done thru the below script code.


'sample package name and location
Dim mySample As String = "C:\SSIS\SampleSSISPackage.dtsx"


' Create an application and load the sample.
Dim app As Application = New Application()
Dim pkg As Package = app.LoadPackage(mySample, Nothing)

Dim myConns As Connections = pkg.Connections
Dim myCMgr As ConnectionManager
Dim oCon As ConnectionManager
Dim oProp As DtsProperty


For Each myCMgr In myConns

'this is an ADO.Net connection manager
If myCMgr.Name = "DB Connection1" Then

''Change the Password
oProp = myCMgr.Properties("Password")
oProp.SetValue(myCMgr, "ABC123")

'this is an OLEDB connection manager
ElseIf myCMgr.Name = "DB Connection2" Then

''Change the Password
oProp = myCMgr.Properties("Password")
oProp.SetValue(myCMgr, "123ABC")

End if

Next


pkg.ProtectionLevel = DTSProtectionLevel.EncryptSensitiveWithPassword
pkg.PackagePassword = "pass1"
app.SaveToXml(mySample, pkg, Nothing)


"DB Connection1" is connecting to IBM DB2 database using the DSN, and it uses the Provider '.Net Providers\Odbc Data Provider' - this is used by 'DataReader Source'

"DB Connection2" is connecting to SQL Server DB, and it uses the provider 'Native OLE DB\SQL Native Client' - this connection is used in 'OLE DB Destination'


the ProtectionLevel property of the existing packages are set to 'EncryptSensitiveWithPassword'

After executing the above script, the connection passwords are not stored in the package.
if i run the sampleSSISpackage.dtsx, it gives 'PASSWORD MISSING' error for connection1 and 'Login failed' for connection2.

how do we change the connection password thru the code.


Any help on this highly appreciated.
sasi.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum







































































































































































SQLServerCentral


Search