Working with tHSQLDb components in Talend Studio

by | Oct 24, 2014 | BlogPosts, Tech Tips

Case Scenario

By far the easiest way to use the “tHSQLDbOutput” component in Talend Studio is with “In Memory” Running Mode. This is because you don’t have to connect to any servers and start using the component immediately. However, using the “In Memory” approach has a couple of drawbacks. You have to specify the Database name, Username and Schema every time you wish to use the component. You can not use an existing connection. Also you might have noticed that the SQL Builder functionality does not work with “In Memory” connection.

Fortunately there is another fast way to start using the “tHSQLDb” components.

Setting-up In Process Persistent Running Mode

Talend Studio

  1. Open Talend Studio and start a new project or use an existing one;
  2. Navigate to Metadata inside of the Repository tab located on the left;
  3. Find Db Connections;
  4. Right-Click and Select “Create connection”;
  5. In the Pop-Up window add a connection name and Click “next”;
  6. Select DB Type “HSQLDB In-Process”;
  7. Populated the rest with the data provided in the table below:
Login SA
Password
DataBase Name you gave your database
Additional parameters ifexists=false
DB Root Path Path in which you created the database
  1. Click the “Check” button to verify that the connection information was specified correctly;HSQL Database connection
  2. Click “Finish”;Connection Status

Sample Job

    1. Pull the new DB connection on to the Job workspace and select “tHSQLDbOutput”;
    2. Repeat the process, but this time select “tHSQLDbInput”;
    3. Select “tLogRow”;
    4. Select “tFileInputDelimited”;
    5. Connect them as shown below:

clip_image006

  1. Create a simple Delimited file by creating a .txt file and opening it with notepad;
  2. Add something similar:

ID, Fname, Lname

1, SomeFirstName, SomeLastName

  1. Save the file as .csv;
  2. Add the file path to your newly created file inside of the “tFileInputDelimited” component;
    1. Change the Field Separation to “,” if you used commas;
    2. Set Header to 1;
    3. Edit the schema to match the schema you created for the file;
  3. Add a Table name for “tHSQLDbOutput” (It can be anything);
    1. Don’t forget to Sync the columns;
  4. Add the same table name to the “tHSQLDbInput” component;
    1. Add a Select all SQL statement in the Query field;
  5. Change the Mode to Table for “tLogRow” (It will improve readability);
  6. Run the Job;

As you can see you are now able to use the in Process Persistent Mode for HyperSQL components. You can use the same database connection for other jobs. Be aware though, that you cannot use the same database connection concurrently with in Process Persistent Mode.

 

0 Comments