4.3. Usage

4.3.1. Registering a database connector

To register a JDBC database connector, you simply need to place the connector .jar file in the subfolder ".../extras/database_connectors" in your RCE installation folder. It will automatically be loaded when you restart RCE. As mentioned above: Currently, only drivers for MySQL and PostgreSQL databases are supported. If you require a different driver class feel free to contact us.

Note

In previous releases we shipped a JDBC connector with RCE. Since we no longer deliver this for security reasons, at least one JDBC database connector must be registered before using the database component. Please inform us if there are problems with the integration of current versions of connectors.

4.3.2. Defining a database connection

In the properties view of the database component there is a "Database" tab. Here you can define the database connection this component works on. Note that currently drivers for MySQL and PostgreSQL databases are supported. The credentials required to access the database can be entered later on when you execute the workflow.

4.3.3. Use the credentials

When you execute a workflow that contains a database component you are asked for the username and password. Note that you can store the password in an encrypted storage if you check the "save" check box.

4.3.4. Database statements

For each database component you can enter multiple statements. They are defined in the "Statement" tab. Pressing the "< + >" tab will open a new statement tab. Every tab must not contain more than one statement. For every statement you can define whether its result should be written to an output. To dynamically compose database statements by using placeholders for inputs you can make use of the "Input" group. A placeholder is added at the current caret position which will be replaced by the actual input value at runtime. Likewise the "Templates" group will insert templates for the given statement types which you can edit to fit your purpose.

4.3.5. Writing multiple times to the same output

It is possible to configure multiple statements to write their result sets to the same output. These results are queued, which can cause subsequent components to run multiple times to consume the queued values. Note that these components must allow queuing of input values for this to work.

4.3.6. Output "success"

There is a static output of type boolean named "success". It is set to true if the given statement and result set distribution was successful. It is useful when a database statement does not yield a result set (like an INSERT statement, for instance) but should trigger the start of a succeeding component. If there are multiple statements defined in a component instance then the "success" output is written when all statements have been processed.

4.3.7. Valid statement types

The database component is designed to query and update databases on a lightweight basis. As already mentioned above, typical database management statements like creating, altering and dropping tables or working on views and user accounts is not the aim of this component. Therefore, only a set of four database statement types is supported. Meaning that each statement must begin with one of the following phrases:

  • SELECT

  • INSERT

  • UPDATE

  • DELETE

4.3.8. Handling Small Tables

Inputs of type "Small Table" can only be used in INSERT statements.

Example:

INSERT INTO table_name (id, col1, col2, col3) VALUES ${in:mySmallTable}

Outputs of type "Small Table" are filled by converting the result set from the database to RCE's data types. Note that small tables cannot be encapsulated in small tables.

4.3.9. Handling Result Sets

If a result set is empty but configured to be written to an output, this is interpreted as an error.

If a result set has exactly one row and one column, it is tried to be mapped to the respective RCE data type.

If a result set has more than one entry and the respective output channel is small table a mapping is executed.

If the respective output channel is boolean, short text, integer or float but the result set has more than one entry this is interpreted as a potential erroneous configuration and causes the component to fail.

If values in the result set are mapped to Java's data type "Big Decimal" it cannot be processed as there is currently no data type of RCE that can represent it.

If values in the result set are mapped to Java's data type Timestamp it cannot be processed as there is currently no data type of RCE that can represent it. As a workaround you can cast or transfer the timestamp to some textual representation with SQL functionalities and work on with this.

If values in the result set are null, it is mapped to RCE's data type "Empty" and has the textual representation "nil".

4.3.10. Local Execution Only

Please note that the database component cannot be published and remotely used. To use the database in your local workflow make sure you can access the database from your machine and configure the database component accordingly.