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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
BA621858188
Creator
Creator

Password storage Approach Environment wise (one time) - Context

Hi Team,

I am new to Talend and working on one flow where My source is MYSQL and need to store all the details like host, username, password into context @Db level. But if I stored the context for password in DB then need to store as hardcode value which is not correct way.

Can anyone help me? What is the way to store a password so that I can use it in a Talend job?

Thanks

Labels (2)
1 Reply
Anonymous
Not applicable

I am not entirely sure of what the requirement is here. Are you trying to store the DB connection details in the DB that you need to connect to? Or are you trying to store other passwords in the DB and you don't want them to be viewed by others in clear text? Either way, this routine may help you to find a solution.

 

I have written a Talend routine (essentially a Java class) which will allow you to encrypt and decrypt your password (or any other String) text at runtime. The code is below.....

 

package routines;

 

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;

 

public class JasyptEncryptionUtils {

 

private static StandardPBEStringEncryptor setEncryptor(String password) {

StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();

   encryptor.setPassword(password);

   encryptor.setAlgorithm("PBEWithMD5AndTripleDES");

   return encryptor;

}

 

  public static String encrypt(String data, String password) {

   StandardPBEStringEncryptor encryptor = setEncryptor(password);

   return encryptor.encrypt(data);

  }

 

 

  public static String decrypt(String data, String password) {

   StandardPBEStringEncryptor encryptor = setEncryptor(password);

   return encryptor.decrypt(data);

  } 

   

}

 

You will need to create a routine with the name of the class seen above, paste this code in and add the Jasypt library to the routine. This is shown below.....

 

0695b00000UzUTeAAN.png 

Then all you do is use the "encrypt" method to encrypt a String and the "decrypt" method to decrypt your String.