Preparing the contexts and context variables - 6.5

Context

author
Talend Documentation Team
EnrichVersion
6.5
EnrichProdName
Talend Big Data
Talend Big Data Platform
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for Big Data
Talend Open Studio for Data Integration
Talend Open Studio for ESB
Talend Open Studio for MDM
Talend Real-Time Big Data Platform
task
Data Governance > Third-party systems > Context components
Data Quality and Preparation > Third-party systems > Context components
Design and Development > Third-party systems > Context components
EnrichPlatform
Talend Studio

Procedure

  1. Create two delimited files corresponding to the two contexts in this scenario, namely two databases we will access, and name them test_connection.txt and prod_connection.txt, which contain the database connection details for testing and actual production purposes respectively. Each file is made of two columns, containing the parameter names and the corresponding values respectively. Below is an example:
    host;localhost
    port;3306
    database;test
    username;root
    password;talend
  2. Select the Contexts view of the Job, and click the [+] button at the bottom of the view to add seven rows in the table to define the following parameters:
    • host, String type

    • port, String type

    • database, String type

    • username, String type

    • password, Password type

    • filename, File type

    • printOperations, Boolean type

    Note that the host, port, database, username and password parameters correspond to the parameter names in the delimited files and are used to set up the desired database connection, the filename parameter is used to define the delimited file to read at Job execution, the printOperations parameter is used to decide whether to print the context parameters set by the tContextLoad component on the console.
  3. Click the Contexts tab and click the [+] button at the upper right corner of the panel to open the [Configure Contexts] dialog box.
  4. Select the default context, click the Edit button and rename the context to Test.
  5. Click New to add a new context named Production. Then click OK to close the dialog box.
  6. Back in the Contexts tab view, define the value of the filename variable under each context by clicking in the respective Value field and browse to the corresponding delimited file.
  7. Select the Prompt check box next to the Value field of the filename variable for both contexts to show the Prompt fields and enter the prompt message to be displayed at the execution time.
  8. For the printOperations variable, click in the Value field under the Production context and select false from the list; click in the Value field under the Test context and select true from the list. Then select the Prompt check box under both contexts and enter the prompt message to be displayed at the execution time.