Store User Names, Passwords, DataSource Names

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

just4geeks
Premium Member
Premium Member
Posts: 644
Joined: Sat Aug 26, 2006 3:59 pm
Location: Mclean, VA

Store User Names, Passwords, DataSource Names

Post by just4geeks »

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....
Attitude is everything....
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

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.
just4geeks
Premium Member
Premium Member
Posts: 644
Joined: Sat Aug 26, 2006 3:59 pm
Location: Mclean, VA

Post by just4geeks »

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.
Thanks for your answer.

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.
Image

And in the database stage,
Image
Attitude is everything....
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

No, you use the $PROJDEF as the parameter value and continue to use the parameters to fill out the different columns in your job.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

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. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
just4geeks
Premium Member
Premium Member
Posts: 644
Joined: Sat Aug 26, 2006 3:59 pm
Location: Mclean, VA

Post by just4geeks »

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. :?
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.

Thanks chulett
Attitude is everything....
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

just4geeks wrote:By new route, you mean the $PROJDEF route, right?
Right!
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
tonystark622
Premium Member
Premium Member
Posts: 483
Joined: Thu Jun 12, 2003 4:47 pm
Location: St. Louis, Missouri USA

Post by tonystark622 »

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.
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:

Code: Select all

GetParameterFromFile(JobParameterFileName, "DB_NAME")
The data is stored in the file as name, "=", and value, like this:
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
Dsnew
Participant
Posts: 90
Joined: Tue Apr 19, 2005 2:08 pm

Post by Dsnew »

Tony,

Can you please share your Routine. It will be very helpfull....

Thanks
Clara
just4geeks
Premium Member
Premium Member
Posts: 644
Joined: Sat Aug 26, 2006 3:59 pm
Location: Mclean, VA

Post by just4geeks »

tonystark622 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.
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:

Code: Select all

GetParameterFromFile(JobParameterFileName, "DB_NAME")
The data is stored in the file as name, "=", and value, like this:
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....
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The User Variables and Job Activity stages are available in Sequence jobs... are you using them to control your processing?
-craig

"You can never have too many knives" -- Logan Nine Fingers
just4geeks
Premium Member
Premium Member
Posts: 644
Joined: Sat Aug 26, 2006 3:59 pm
Location: Mclean, VA

Post by just4geeks »

chulett wrote:The User Variables and Job Activity stages are available in Sequence jobs... are you using them to control your processing?
I am not using Sequence Jobs at all. Is there no way to do what tony described in Server jobs?
Attitude is everything....
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
just4geeks
Premium Member
Premium Member
Posts: 644
Joined: Sat Aug 26, 2006 3:59 pm
Location: Mclean, VA

Post by just4geeks »

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.
If I get what you mean my job control...then I run the jobs using a UNIX script.
Attitude is everything....
just4geeks
Premium Member
Premium Member
Posts: 644
Joined: Sat Aug 26, 2006 3:59 pm
Location: Mclean, VA

Post by just4geeks »

Tony,

It would be great if you could share your GetParameterFromFile routine..

Thanks,
Attitude is everything....
Post Reply