dbTalk Databases Forums  

Connection.password property when enumerating package connections

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Connection.password property when enumerating package connections in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
James McMorrough
 
Posts: n/a

Default Connection.password property when enumerating package connections - 11-17-2003 , 12:06 PM






Hi All

I've written a package that gets all packages on a server, then runs through each of the packages, then enumerates the connections in each package, and attempts to translate certain properties to facilitate moving packages between servers

my code seems to happliy replace server names, user ids and catalogs, but fails dismally to do anything with the password property. in fact, when I break the code in the activex script debugger, all the password properties seem to be blank? is this property 'non viewable' once it has been set, or am I overlooking something blindingly obvious? any help from the DTS uber-Gurus would be greatly appreciated, here's a portion of the offending code

Thanks in advance


Function Main(

dim DTSApp, pkgSQL, pkgInfos, inf

Dim pkg, con, tsk, lkp, dpta, dto
Dim fso, fld, fi

Dim txtPkgNam

Dim EnvironmentI
Dim PackageI
Dim ConnectionI
Dim TaskI

'--

'Get values for global

gvDataSource=DTSGlobalVariables("DataSource").valu
gvCatalog=DTSGlobalVariables("Catalog").valu
gvUserID=DTSGlobalVariables("UserID").valu
gvPassword=DTSGlobalVariables("Password").valu

'--

CreateADOConnectio

'--

set DTSApp = CreateObject("DTS.Application"

'set pkgSQL = DTSApp.GetPackageSQLServer(gvDataSource,gvUserID,g vPassword, DTSSQLStgFlag_UseTrustedConnection
set pkgSQL = DTSApp.GetPackageSQLServer(gvDataSource,gvUserID,g vPassword,DTSSQLStgFlag_Default

set pkgInfos = pkgSQL.EnumPackageInfos("", True, ""

set info = pkgInfos.Nex

do until pkgInfos.EO

'got the package nam
txtPkgName = info.nam

'Get each package in tur
set pkg = CreateObject("DTS.Package"
' pkg.LoadFromSQLServer gvDataSource, gvUserID,gvPassword,DTSSQLStgFlag_UseTrustedConnec tion,"","","", txtPkgNam
pkg.LoadFromSQLServer gvDataSource, gvUserID,gvPassword,DTSSQLStgFlag_Default,"","","" , txtPkgNam

'we've got a reference to each package on the server
'msgbox pkg.nam

'--

For Each con in pkg.Connection

'replace the values in connections !

sto

''con.ConnectionProperties("Persist Security Info") = GetTranslation(con.ConnectionProperties("Persist Security Info")
'con.ConnectionProperties("User ID") = GetTranslation(con.ConnectionProperties("User ID")
'con.ConnectionProperties("Initial Catalog") = GetTranslation(con.ConnectionProperties("Initial Catalog")
'con.ConnectionProperties("Data Source") = GetTranslation(con.ConnectionProperties("Data Source")
''con.ConnectionProperties("Application Name") = GetTranslation(con.ConnectionProperties("Applicati on Name")


con.Name = GetTranslation(con.Name)
con.Description = GetTranslation(con.Description)

con.DataSource = GetTranslation(con.DataSource)
con.UserID = GetTranslation(con.UserID)
con.Password = GetTranslation(con.Password)



Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Connection.password property when enumerating package connections - 11-17-2003 , 02:38 PM






You cannot grab the password

http://www.microsoft.com/technet/tre...n/MS00-041.asp

--

Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"James McMorrough" <james.mcmorrough (AT) sqlpersonnel (DOT) com> wrote

Quote:
Hi All,

I've written a package that gets all packages on a server, then runs
through each of the packages, then enumerates the connections in each
package, and attempts to translate certain properties to facilitate moving
packages between servers.
Quote:
my code seems to happliy replace server names, user ids and catalogs, but
fails dismally to do anything with the password property. in fact, when I
break the code in the activex script debugger, all the password properties
seem to be blank? is this property 'non viewable' once it has been set, or
am I overlooking something blindingly obvious? any help from the DTS
uber-Gurus would be greatly appreciated, here's a portion of the offending
code.
Quote:
Thanks in advance,



Function Main()

dim DTSApp, pkgSQL, pkgInfos, info

Dim pkg, con, tsk, lkp, dpta, dtot
Dim fso, fld, fil

Dim txtPkgName

Dim EnvironmentID
Dim PackageID
Dim ConnectionID
Dim TaskID

'---

'Get values for globals

gvDataSource=DTSGlobalVariables("DataSource").valu e
gvCatalog=DTSGlobalVariables("Catalog").value
gvUserID=DTSGlobalVariables("UserID").value
gvPassword=DTSGlobalVariables("Password").value

'---

CreateADOConnection

'---

set DTSApp = CreateObject("DTS.Application")

'set pkgSQL = DTSApp.GetPackageSQLServer(gvDataSource,gvUserID,g vPassword,
DTSSQLStgFlag_UseTrustedConnection)
set pkgSQL =
DTSApp.GetPackageSQLServer(gvDataSource,gvUserID,g vPassword,DTSSQLStgFlag_De
fault)
Quote:
set pkgInfos = pkgSQL.EnumPackageInfos("", True, "")

set info = pkgInfos.Next

do until pkgInfos.EOF

'got the package name
txtPkgName = info.name

'Get each package in turn
set pkg = CreateObject("DTS.Package")
' pkg.LoadFromSQLServer gvDataSource,
gvUserID,gvPassword,DTSSQLStgFlag_UseTrustedConnec tion,"","","", txtPkgName
pkg.LoadFromSQLServer gvDataSource,
gvUserID,gvPassword,DTSSQLStgFlag_Default,"","","" , txtPkgName

'we've got a reference to each package on the server!
'msgbox pkg.name

'---

For Each con in pkg.Connections

'replace the values in connections !!

stop

''con.ConnectionProperties("Persist Security Info") =
GetTranslation(con.ConnectionProperties("Persist Security Info"))
'con.ConnectionProperties("User ID") =
GetTranslation(con.ConnectionProperties("User ID"))
'con.ConnectionProperties("Initial Catalog") =
GetTranslation(con.ConnectionProperties("Initial Catalog"))
'con.ConnectionProperties("Data Source") =
GetTranslation(con.ConnectionProperties("Data Source"))
''con.ConnectionProperties("Application Name") =
GetTranslation(con.ConnectionProperties("Applicati on Name"))


con.Name = GetTranslation(con.Name)
con.Description = GetTranslation(con.Description)

con.DataSource = GetTranslation(con.DataSource)
con.UserID = GetTranslation(con.UserID)
con.Password = GetTranslation(con.Password)





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.