Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I tried to Load value from database and set in a context variable.
I have a table DatabaseConfig and two column (key,value).
Created two context in my job as key and value.
When i try to run the job, the output i am receiving is null
Hi Dinesh,
Are you looking read context values from DB and assign to context variables in job?
For this you need to define context variable name is same as key value in database.
Here key value is day, so you need to define context variable name as day. Then tContextLoad will assign value (monday) to context "day"
Hope this helps you.
Regards,
Hi,
Can you share your job design?
At least, which components are you using?
It should work.
Double check variables name in your tJava component.
Also verify columns name in SQL schema are aligned with context variables name defined for the job.
I have attached 4 files.
-> Database table
-> Context variable for my Job
-> SQL Input connection page
-> Page where to load context detail from DB.
Could you check this and let me know for any further information
What's in your tJava component?
What's in your tMSSqlInput component? Should have 2 fields, not 3 as there in the table.
I am getting output as :
Starting job DatabaseJob at 16:57 30/03/2018.
[statistics] connecting to socket on port 3429
[statistics] connected
Implicit_Context_Context set key "days" with value "monday"
Warning: Parameter "days" is a new parameter of Implicit_Context_Context
Warning: Parameter "Key" has not been set by Implicit_Context_Context
Warning: Parameter "Value" has not been set by Implicit_Context_Context
tContextLoad_4 set key "days" with value "monday"
hi
DatabaseJob
[statistics] disconnected
Job DatabaseJob ended at 16:57 30/03/2018. [exit code=0]
tJava i am printing :
System.out.println("hi");
System.out.println(context.Key);
System.out.println(context.Value);
System.out.println(jobName);
databasepage -> this jpg which i attached is tMSSqlInput component.
Ok i changed my Database table to two columns.
Hi Dinesh,
Are you looking read context values from DB and assign to context variables in job?
For this you need to define context variable name is same as key value in database.
Here key value is day, so you need to define context variable name as day. Then tContextLoad will assign value (monday) to context "day"
Hope this helps you.
Regards,
what if i want to read values from the queries and store them into globalmap variables??
ex: If i am using tmssqlinput and query is:
"select col1 from table1;
select col2 from table2;
"
Note: for the above query i am getting value for col1 only, col2 is NULL even after setting the additional jdbs parameters with "allowMultiQueries=true"
Please help