How to set password encryption in Talend Studio
In this example, we will use ROT13 to encrypt the password for a MySQL database connection, so that the password "talend" is transformed to "gnyraq" in the Studio. For more information on the ROT13 algorithm, see https://en.wikipedia.org/wiki/ROT13.
This article applies to all versions of Talend Studio.
Creating a custom routine
In this procedure we will create a custom routine to execute the algorithm for password encryption.
Procedure
Validating password transformation using a demo Job
In this procedure we will create a demo Job to validate the password encryption. In this Job, we use a tMysqlInput to read data from a table called person from the database (it can be configured to read data from any a table in your case) and print the result on the console with tLogRow component.
Before you begin
This example assumes that you have a MySQL database, with the following information:
- host name: localhost
- port: 3306
- database name: test
- user name: root
- password: talend
- table name: person
- table columns:
- id: type Inter (INT), 2 characters long
- name: type String (VARCHAR), 20 characters long
- sex: type String (VARCHAR), 1 character long
Procedure
Results
The Run console displays the data retrieved from the specified database table.
Troubleshooting password encryption
If the Job fails, you may see the following error information on the Run console:
Exception in component tMysqlInput_1
java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075)
This error indicates that you have failed the authentication when trying to connect to the database. Check that:
- You have the right user name/password for the database connection before encrypting the password using ROT13.
- You have transformed the right encryption string from your real password using a custom routine.
- You have provided the encryption string as the default value of context variable.
- You have correctly configured the database component to call the custom routine function.