Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
kleinmat
Contributor III
Contributor III

Using Context-Variables in DB-Connections?

Hi everyone,
I am a Talend newbie who is just trying to build a little job connecting to an Oracle DB to pull out some data. Basic stuff 🙂
So here's what I have done since this morning:
1. Created a project
2. Created a context group in the metadata
3. Created a context for each system environment that job will later run (Test, Production etc.)
4. Created a set of suitable context variables (especially for the DB connection)
What I have been stuck with for the past few hours and could not resolve by reading manuals is this:
I created a DB-Connection in the Metadata-section of Talend, chose "Oracle with SID" as type and tried to use the already existing context variables.
But Talend wouldn't let me.
When I entered the connection data of my test environment directly into the text fields, I was successfully able to test the connection.
But when I then replaced the text field content with variables like
context.username
context.password
nothing worked anymore. It was not even possible to enter
context.port
into the "port" field
All I found was the option to "export as context". But when I did that, it would create a whole new context group, create new variable names and everything - and would disregard all the settings in "my" context group that was already created.
I find that very confusing.
My 2 questions to you are:
1. Have I generally set my project up properly? (Using global context groups, db-connections in the metadata etc.)
2. Is it even possible to use pre-existing context variables in a db connection? (If so: how?)
Thanks
Matt
Labels (2)
11 Replies
Anonymous
Not applicable

Contexts are initialized at run time. I do not think you can add that to the Metadata section & test it out because they don't get initialized during that test. For testing the connection you will need the absolute values.

 

However, you can add that to the metadata schema, use that schema as an input/ output and then test it out. It should work definitely. 

Anonymous
Not applicable

Hi all,

 

While on the subject on DB connections and contexts...

Lets say I created 2 distinct Oracle connections which I exported as context.

Is it possible to have a input parameter which would allow me to switch the connection on a given job?

For instance, I have several databases that contain the same table name which I have to extract data. I would like to avoid recreating the same job for each databases because if the table changes, it will impact both jobs.
My goal would be to fetch data both databases by running the same job on using a parameter that would toggle source DB connection. Is this possible? Could someone provide the steps and/or screen prints as example?

 

Thanks,