Write to database🔗

Writes data to a table in an SQL database. A new row will be written on each processing round.

Inputs🔗

  • driver: The name of the database driver to use. Valid values depend on installed plugins and the operating system environment. The following drivers may be available:

    • mysql - MySQL (version 5.0 and above)

    • mariadb - MariaDb

    • psql - PostgreSQL (version 7.3 and above)

    • sqlite - SQLite (version 3 or above)

    • odbc - ODBC (includes Microsoft SQL Server)

    • oci - Oracle

    • db2 - IBM DB2 (version 7.1 and above)

    • ibase - Borland InterBase

    Leaving the driver empty (None) causes the tool to ignore all input parameters. This is useful when no real database is available to avoid breaking the processing graph.

  • userName: Database user to connect as.

  • password: Database password.

  • host: The name of the database host, either a host name or an IP address.

  • port: The TCP port number of the database host. If port is zero, the default port of the selected database driver will be used.

  • databaseName: The name of the database schema. For SQLite, use the absolute path of a database file or a URI reference to the app’s resources (starts with "res://"). For ODBC, the database name can be either a DSN, a DSN filename (with a .dsn extension, resource URI is supported) or a connection string such as "Driver={Microsoft Access Driver (*.mdb)};Dbq=accessfile.mdb;Uid=Admin;Pwd=;" Note that resource URIs are not supported in files encoded in the connection string.

  • tableName: The name of the database table to write into.

  • columns: A table that defines the table columns to write into. The first column contains the name of a column and the second one its data type.

  • errorHandling: The way temporary database connection failures while writing are handled. Note that other types of errors such as not being able to establish a connection in the first place, incorrect table name or other SQL errors always generate a run-time failure. Different database engines have different error behavior. For example, columns in SQLite are typeless by default. An INSERT statement that works in SQLite may fail in MySQL even if the column definitions are identical.

  • retryDelay: The number of milliseconds to wait before a retry if errorHandling is set to RetryOnError.

Each column has a corresponding dynamic input parameter. The types or contents of the input parameters are not checked by the tool at run time. The database back-end may or may not accept the value, depending on the actual column type and other restrictions such as string length.

Note that all connection parameters are not always required. For example, only databaseName and tableName are needed for SQLite and ODBC.

enum ErrorHandling🔗

Possible ways of handling connection errors.

Values:

enumerator FailOnError🔗

Generate a run-time failure on error.

enumerator RetryOnError🔗

Log the error and retry after retryDelay milliseconds.

Generate a run-time error if the the second attempt also fails.

enumerator LogError🔗

Write the error message to log, but do not generate a failure.