Five Stars

How to load credentials at runtime

I need some ideas.   I want to set my Database IDs and passwords to variables and have the values for the loaded from a file at runtime so that i can move a file from one deployment to another and have it automatically pick up the new values from the file in that location.  

 

The approach i used is:

 

I tried to write the values to a file as Key;Value

I then set up a job which reads from this file and flows to a contextload component.

My intent is to use this job as a subjob

 

The problem is:

 

When i drag this child into a parent as the first item on the list, the database connections i have defined (which have context variables as credentials) fail at compile time as not being defined.    If i deactivate that database piece and instead put in a contextdump, indeed the context variables loaded in the child job are created and referenceable.  The problem is simply the compile time check fails the job.

 

How do i best get this to work.  I want to avoid defining the context variables in each parent job i make and instead i would just prefer that all credentials in the file get loaded and the jobs i pull in can reference what they need.

  • Data Integration
4 REPLIES
Nine Stars

Re: How to load credentials at runtime

sorry hard to understand - what wrong

 

but it work exactly!

Could You explain (better with screenshots) - what are You do, and where error?

-----------
Four Stars

Re: How to load credentials at runtime

If I understand correctly, you need to provide Database parameters to your job from a file so that it will be easy to change the parameters of the file when deployed in different environment?

If that is your requirement you can check Implicit Context Load under edit project settings of File Menu & select from file and you can give the path of your context file and in your job you need to create the context variable with the names specified in your file and use the same in the component settings and you are good to go..Smiley Wink

 

Five Stars

Re: How to load credentials at runtime

That is interesting but not quite a solution to the problem I voiced.
I can certainly take that approach or the one im taking but both require I define the context variables in the job itself.

I'm trying to find a way to avoid the need to manually create context variables within the job itself. Do I need to use global variables instead? If so, how Do I reference them in the connection details of the job.

Nine Stars

Re: How to load credentials at runtime

but in this case - how You plan run Job standalone?

 

You still need define variables in Job it self ...

-----------