Six Stars

Problem with type password as context variable

Good afternoon,
I've got an issue when I use a context variable which type is password.
When I tried to execute it (without any others components), I get the following error :
routines.system.JSONException: JSONObject not found.
       at routines.system.JSONObject.get(JSONObject.java:363)
       at routines.system.ResumeUtil.convertToJsonText(ResumeUtil.java:339)
       at gouvernance_2012.testaaa_0_1.testaaa.runJobInTOS(testaaa.java:429)
       at gouvernance_2012.testaaa_0_1.testaaa.main(testaaa.java:304)

In attachment the job I tried to execute.
I've just installed the TOS DI 5.6.0, it was not a problem on my last Talend 5.0.1.
How could i fixed that ?
Thanks a lot for your help !

8 REPLIES
Moderator

Re: Problem with type password as context variable

Hi,
What's your current job? Is it OK without using Context Variable in your job?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Problem with type password as context variable

Hi,
First of all, do you necessarily need the password to be saved with your job. Decoupling the code & the credentials is almost generally a better practice. Smiley Happy
Having said that, the same thing worked on my Talend (v5.2.2). So, I don't see any reason for it to not work for your version.
Just a pointer, I hope you have configured the job to specifically pick the values from within the saved values & the job isn't looking for the value in a config file.
Hope this helps. Let me know if it doesn't.
MathurM

Re: Problem with type password as context variable

Hi bouga,
When you use password datatype in context then in older version: You will see the value as db_apssword = "test". But in 5.6: You will see the password value in in binary like db_password = 5e7h1j56271809b5. That is the reason you are getting password as null.
Can you please change the password datatype in 5.6 from "password" to "String" and try once? Thank you!
May be this is a bug I guess. 
Regards
Srikanth
   
Six Stars

Re: Problem with type password as context variable

Hi bouga,
When you use password datatype in context then in older version: You will see the value as db_apssword = "test". But in 5.6: You will see the password value in in binary like db_password = 5e7h1j56271809b5. That is the reason you are getting password as null.
Can you please change the password datatype in 5.6 from "password" to "String" and try once? Thank you!
May be this is a bug I guess. 
Regards
Srikanth
   

Thanks everybody for your answers !
That's true, when I put my variable in String, now I don't have the error and everything looks good.
Except I have to open manually every jobs using my password variable to apply the modification I have done in my context environnement (you can see in attachment, maybe between 500 and 1000 jobs on my 4 projects Smiley Happy)) ). Is there a way to do that ? Or do I have to migrate in 5.5.1 (if there is not this problem) ?
Thanks a lot !

Re: Problem with type password as context variable

Hi Bouga,
You can use tContextLoad component in order to read the password dynamically from the file. You no need to do manually for each Job.
Please refer the "tContextLoad" example. Please let me know if it helps you? Thank you.
Regards
Srikanth
Six Stars

Re: Problem with type password as context variable

Hi Bouga,
You can use tContextLoad component in order to read the password dynamically from the file. You no need to do manually for each Job.
Please refer the "tContextLoad" example. Please let me know if it helps you? Thank you.
Regards
Srikanth

Hi srikantharavapalli,
Thanks a lot for your answer, I'm already using a tContextLoad at the beginning of my jobs but the problem is here.

Not applicable

Re: Problem with type password as context variable

Hi All
I have found what appears to be a workaround. If the Password context begins with the first two letters of another context or "Pa" you get the above error. e.g
Contexts: Database , Hosts , Login
Names that fail for the Password context : Da.... , Ho....., Lo.....
Names that work : all except above. This is case sensitive so da.... and ho.... work
Cheers
Ian
One Star

Re: Problem with type password as context variable

Hi All.
I can confirm that renaming the context var from "Mydatabase_Password" to "DBMydatabase_Password" does effectively resolve the problem.
I hope it'll be fixed soon.