Configuring the components
Procedure
-
Double-click the cSQLConnection
component to display its Basic settings view in
the Component tab.
-
Configure the properties as follows:
- In the Driver Class field, enter the class name for the H2 database, "org.h2.Driver".
- Click the [+] button under the Driver JAR table to add a row.
-
Select the cell and click the [...] button at the
right side of the cell to open the Module dialog
box.
- Click the Platform option and select the driver JAR h2-2.1.214.jar from the list.
- Click OK to close the Module dialog box.
- In the JDBC URL field, enter the JDBC URL of the database to be used, "jdbc:h2:tcp://localhost/~/test" in this example.
- Select the Authentication check box and enter the database user authentication data.
-
Double-click the cTimer
component in the first subRoute, to display its Basic
settings view in the Component
tab.
- Set the values for the Period (500), Repeat (1) and Delay (100) fields as shown above to trigger a message exchange after a delay of 100 milliseconds in the first subRoute.
-
Repeat this step to configure the other two cTimer
components to trigger three message exchange after a delay of 500 milliseconds every
500 milliseconds in the second subRoute and one message exchange after a delay of
3000 milliseconds in the third subRoute.
-
Double-click the cSQL component
in the first subRoute to display its Basic
settings view in the Component
tab.
-
In the Datasource list, select
cSQLConnection_1 to use the database connection established
in it. In Query box, enter the following code to
create a TEST_TABLE of four columns ID,
Firstname, Lastname, and RegisterDate
DATE in the database:
"CREATE TABLE IF NOT EXISTS TEST_TABLE ( ID INTEGER auto_increment NOT NULL, Firstname VARCHAR(25), Lastname CHAR(25) NOT NULL, RegisterDate DATE DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (ID) )"
-
Double-click the cSetBody component to display its
Basic settings view in the Component
tab.
- Select Constant in the Language list and enter "INSERT INTO TEST_TABLE (Firstname, Lastname) VALUES ('Mike', 'Jonson')" in the Expression field.
-
Double-click the cSQL component in the second subRoute to
display its Basic settings view in the
Component tab.
- Select cSQLConnection_1 in the Datasource list and select the Use SQL statement from message body check box.
-
Double-click the cSQL component in the third subRoute to
display its Basic settings view in the
Component tab.
- Select cSQLConnection_1 in the Datasource list and enter "select * from TEST_TABLE" the Query box.
-
Double-click the cLog component in the first subRoute, to
display its Basic settings view in the
Component tab.
-
Configure the properties as follows:
- Select the Format the log output option.
- In the Arguments table, click [+] to add two rows and enter "multiline" and "showheaders" in the Name field. In the value field, enter true for both the two arguments.
- Keep the default settings of the other options.
- Repeat this step to configure the other two cLog components in the same way.
- Press Ctrl+S to save your Route.
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!