Solved

SSIS Package losing password in dynamic ole db connection on second run through a ForEach Loop container

Posted on 2013-06-17
10
784 Views
Last Modified: 2016-02-11
I've built an ssis package to loop through a list of servers. I'm using a foreach loop container to do the looping with a sql server task querying a dynamic ole db connection against the server for that loop using SQL Server Authentication. It seems to work fine for the first iteration but then loses the password for the second iteration. Does anyone know how to fix this please? I've tried setting the protectionlevel property for the package to be EncryptSensitiveWithPassword as some sites suggest but I get the same problem.
0
Comment
Question by:Grffster
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
LVL 11

Expert Comment

by:SThaya
ID: 39253104
Hi,

  use the below expression in the connection string properties

"Data Source="+ REPLACE ( @[User::Desti_server]  ,"\\","\\")+";User ID="+ @[User::Desti_UName] +";Password="+ @[User::Desti_Pwd] +";Initial Catalog="+ @[User::Desti_DB] +";Provider=SQLNCLI10.1;Persist Security Info=True;Auto Translate=False;"
 
this will pass your password dynamically
0
 

Author Comment

by:Grffster
ID: 39253139
It will have to be hard-coded in to the package then though won't it?
0
 
LVL 11

Expert Comment

by:SThaya
ID: 39253151
can you please tell me where are you storing the connection string properties like server,db,password etc

and

can you give me the stepts you done with your package
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 11

Expert Comment

by:SThaya
ID: 39253156
or try Encrypt all with password  option in package protection level
0
 

Author Comment

by:Grffster
ID: 39253185
The purpose of the package is to loop through a number of servers checking for SQL Agent job failures. I have a table in a database on my warehouse server that contains a list of servers to check. I run a sql task to populate a variable of type object with the result set containing these server names and then use a foreach loop container to loop through these connecting to the SQL server using a dynamic ole db connection in connection manager.  The server name is set by a variable (equating to that loop of the container) populating the ServerName Expression. This connection is using a SQL Server Authentication user account and password. I think it's this password that's being dropped each time.
0
 

Author Comment

by:Grffster
ID: 39253192
Same result with the Encrypt All With Password option.
0
 
LVL 11

Expert Comment

by:SThaya
ID: 39253206
so each server has different user name and password or same ?

if its different you have to pass username,server name and password dynamically ......
0
 

Author Comment

by:Grffster
ID: 39253216
Same  username and password. This is the strange issue with it. I can understand if they were different: "Login failed for user 'XXX'.".
0
 
LVL 11

Accepted Solution

by:
SThaya earned 500 total points
ID: 39253265
0
 

Author Comment

by:Grffster
ID: 39253323
Ah! Bingo!!! Just realised the problem thanks to you asking the question about the DB. The dynamic ole db connection was trying to connect to a database that only existed on the first server. I needed to pick a common database to all servers e.g. tempdb. Doh!
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need SSIS project 2 57
Database Owner 3 45
sql server major issue  need help 2 82
SQL Server how to use a VARIABLE to link tables in a SQL Script? 3 41
Lessons learned during ten years of interviewing for SQL Server Integration Services (SSIS) and other Extract-Transform-Load (ETL) contract roles and two years of staff manager interviewing contractors.
Here's a requirements document template for an integration project (also known as Extract-Transform-Load or ETL) based on my development experience as an SQL Server Information Services (SSIS) developer over the years.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question