Store User Names, Passwords, DataSource Names
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 644
- Joined: Sat Aug 26, 2006 3:59 pm
- Location: Mclean, VA
Store User Names, Passwords, DataSource Names
In my job, I use a database stage and I usually fill in the DataSource Name, User Name and Password directly in the fields.
But is there a way to store these variables in a file that the job can read from during runtime? This will let me change the values of the variables in the file and not in the job in the event that the data source name or username changes. Moreover, does DS let me encrypt/decrypt the file?
Thanks for your help in advance....
But is there a way to store these variables in a file that the job can read from during runtime? This will let me change the values of the variables in the file and not in the job in the event that the data source name or username changes. Moreover, does DS let me encrypt/decrypt the file?
Thanks for your help in advance....
Attitude is everything....
You can define them as environment variables in the Administrator and use $PROJDEF in their place inside your stages. This way all you need to do is change the values in the administrator and the jobs will pick up the correct value during runtime.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Premium Member
- Posts: 644
- Joined: Sat Aug 26, 2006 3:59 pm
- Location: Mclean, VA
Thanks for your answer.DSguru2B wrote:You can define them as environment variables in the Administrator and use $PROJDEF in their place inside your stages. This way all you need to do is change the values in the administrator and the jobs will pick up the correct value during runtime.
However, if I type $PROJDEF for all of database source name, user id, and password, how does it know to associate which field to which environment variable?
I have set my environment variables as follows.
And in the database stage,
Attitude is everything....
No, you use the $PROJDEF as the parameter value and continue to use the parameters to fill out the different columns in your job.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Or... if you really wanted to go that route... store them in a file. 'Encrypt' the file if you like. You would then need to have some home-brewed Job Control in place to read (and possible decrypt) that information and dynamically set those values when starting the jobs.
Many of us have such a beastie in place from long before the $PROJDEF option became available. However, for people not in that boat, I'd suggest taking the new route - assuming you are on a 'recent' 7.x release of DataStage like 7.5 and up. From what I recall, it didn't quite work right at first.
Many of us have such a beastie in place from long before the $PROJDEF option became available. However, for people not in that boat, I'd suggest taking the new route - assuming you are on a 'recent' 7.x release of DataStage like 7.5 and up. From what I recall, it didn't quite work right at first.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Premium Member
- Posts: 644
- Joined: Sat Aug 26, 2006 3:59 pm
- Location: Mclean, VA
By new route, you mean the $PROJDEF route, right?...If so, I think I am sticking to the new route. I am using 7.5.2.chulett wrote:Or... if you really wanted to go that route... store them in a file. 'Encrypt' the file if you like. You would then need to have some home-brewed Job Control in place to read (and possible decrypt) that information and dynamically set those values when starting the jobs.
Many of us have such a beastie in place from long before the $PROJDEF option became available. However, for people not in that boat, I'd suggest taking the new route - assuming you are on a 'recent' 7.x release of DataStage like 7.5 and up. From what I recall, it didn't quite work right at first.
Thanks chulett
Attitude is everything....
-
- Premium Member
- Posts: 483
- Joined: Thu Jun 12, 2003 4:47 pm
- Location: St. Louis, Missouri USA
Actually, you can do this in a Routine... I use a UserVariables Activity, define a variable and in the Derivation call my GetParameterFromFile routine to retrieve the value. You can then pass it into a job by using the Elipsis button and selecting the UserVariables stage (I call mine PARAMETERS) and the Variable name. This might look like:Or... if you really wanted to go that route... store them in a file. 'Encrypt' the file if you like. You would then need to have some home-brewed Job Control in place to read (and possible decrypt) that information and dynamically set those values when starting the jobs.
Code: Select all
GetParameterFromFile(JobParameterFileName, "DB_NAME")
DB_NAME=yourDB
DB_USER=yourUser
DB_PWD=yourPWD
If you gin up your own encryption/decryption routines, you can use a different routine to decrypt the password when it's fetched from the file.
Good luck,
Tony
-
- Premium Member
- Posts: 644
- Joined: Sat Aug 26, 2006 3:59 pm
- Location: Mclean, VA
tonystark622 wrote:Actually, you can do this in a Routine... I use a UserVariables Activity, define a variable and in the Derivation call my GetParameterFromFile routine to retrieve the value. You can then pass it into a job by using the Elipsis button and selecting the UserVariables stage (I call mine PARAMETERS) and the Variable name. This might look like:Or... if you really wanted to go that route... store them in a file. 'Encrypt' the file if you like. You would then need to have some home-brewed Job Control in place to read (and possible decrypt) that information and dynamically set those values when starting the jobs.The data is stored in the file as name, "=", and value, like this:Code: Select all
GetParameterFromFile(JobParameterFileName, "DB_NAME")
DB_NAME=yourDB
DB_USER=yourUser
DB_PWD=yourPWD
If you gin up your own encryption/decryption routines, you can use a different routine to decrypt the password when it's fetched from the file.
Good luck,
Tony
Thanks Tony for your answer....
However, I am lost. How do I get to the "UserVariables Activity" or the "UserVariables stage"?
I am just starting out....so I am not too familiar with DS.
Thanks for your time...
Attitude is everything....
-
- Premium Member
- Posts: 644
- Joined: Sat Aug 26, 2006 3:59 pm
- Location: Mclean, VA
No. What Tony described is one of the many things Sequence jobs bring to the table - automation of parameter assigned being one such.
What are you using for 'job control'? You'll need to find a methodology that is compatible with that.
What are you using for 'job control'? You'll need to find a methodology that is compatible with that.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Premium Member
- Posts: 644
- Joined: Sat Aug 26, 2006 3:59 pm
- Location: Mclean, VA
If I get what you mean my job control...then I run the jobs using a UNIX script.chulett wrote:No. What Tony described is one of the many things Sequence jobs bring to the table - automation of parameter assigned being one such.
What are you using for 'job control'? You'll need to find a methodology that is compatible with that.
Attitude is everything....
-
- Premium Member
- Posts: 644
- Joined: Sat Aug 26, 2006 3:59 pm
- Location: Mclean, VA