Validating password transformation using a demo Job - Cloud

Talend Cloud Data Management Platform Studio User Guide

Version
Cloud
Language
English (United States)
Product
Talend Cloud
Module
Talend Management Console
Talend Studio
Content
Design and Development

In this procedure, create a demo Job to validate the password encryption. In this Job, use a tMysqlInput component to read data from a table called person from the database and print the result on the console with tLogRow component.

Before you begin

Check 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

Also, check that you have a plain text file that contains the following database connection parameters:

Host;localhost
Database;test
Port;3306
Username;root
Password;gnyraq
Table;person

Note that the password gnyraq is the encrypted form of the real password talend and will be transformed to the real password using ROT13 at Job execution.

Procedure

  1. Create a new Job and name it EncryptPasswordWithR0T13Demo.
  2. Add a tFileInputDelimited component, a tContextLoad component, a tDBInput component, and a tLogRow component to your Job.
  3. Connect the components:
    1. Connect the tFileInputDelimited to the tContextLoad using a Row > Main connection.
    2. Connect the tDBInput to the tLogRow using a Row > Main connection.
    3. Connect the tFileInputDelimited to the tDBInput using a Trigger > OnSubjobOk connection.
  4. Open the Contexts view, and add the following variables, all with an empty value:
    • Host, of type String
    • Database, of type String
    • Port, of type String
    • Username, of type String
    • Password, of Password
    • Table, of type String
  5. In the Basic settings view of tFileInputDelimited, configure the component to read the text file that holds the database access parameters:
    • Configure the schema so that it contains two columns, key and value, corresponding to the read-only schema of the tContextLoad component.
    • In the File name/Stream field, specify or brose to the path to the input text file that contain the database access parameters.
  6. From the Database list of the tDBInput component, select MySQL and click Apply so that the component becomes a tMysqlInput.
  7. In the Basic settings view of tMysqlInput, configure the database access parameters:
    • In the Host, Port, Database, Username, and Table Name fields, specify the corresponding variables you have defined in the Contexts view.
    • Click the [...] button next to the Password field, and enter the expression to call the custom routine function in the Enter a new password dialog box, MyRoutine.decrypt(context.Password) in this example.
  8. Configure the schema based on your database table structure and click Guess Query to fill the query statement.
  9. Save and execute the Job.

Results

You should be able to connect to the database and read data from it.