Broadway has a category of db Actors that are useful for performing DB commands and actions like creating a new table, loading data or fetching it and executing other DB commands. These Actors are:
Each Actor in the db category requires an interface input argument that can be defined either as a reference to the Fabric DB Interface or as a JDBC URL.
The schema, table, fields and sql input arguments of db Actors are case-insensitive.
Data writing Actors can work in a batch mode. When the batch input argument is set to true, the Actor accumulates statements and performs them as a batch for better performance. It needs to be run in a transaction and the errors are reported as the batch is committed (every X record or on commit). The default batch size is set to 1,000.
Starting from Fabric V8.2.3, the DbErrorHandlerBatch and DbFlushBatch Actors are introduced to set a batch error handler and define how to handle errors without failing the entire batch. See a detailed explanation and example further in this article.
If the DB command executed by the db Actor fails, the actual SQL statement is sent to the log file. For example:
Caused by: java.sql.SQLException: [SQLITE_CONSTRAINT] Abort due to constraint violation
(UNIQUE constraint failed: CONTRACT_COPY.CONTRACT_ID)
INSERT INTO "main"."CONTRACT_COPY" ("CUSTOMER_ID","CONTRACT_ID","CONTRACT_REF_ID") VALUES (?,?,?)
Using DbLoad Actor
To load the data using the DbLoad Actor, populate the Actor's input arguments as follows:
Using DbCommand Actor
Another way to load the data in a Broadway flow is by using the DbCommand Actor and writing the SQL INSERT statement in the sql input argument. The values to be populated in the table can be taken from the input arguments using the parameters. For example:
INSERT INTO DATA (TEXT) VALUES (${text} )
Where ${text} is replaced with the value of the text input argument in the prepared statement.
The DbCommand Actor’s sql input argument includes an SQL statement which is executed by the Actor. The SQL statement can be created dynamically using prepared and non-prepared statement parameters.
The syntax is:
? - for ordered parameters.
${param_value} - for named parameters.
${@param} - for non-prepared statement parameters.
The values of named parameters are taken from the Actor's input arguments or from the params input argument and only if it is a map. For ordered parameters, the params input argument should be an array or a single value (not a map).
For example, the SQL statement:
Select * From CASES where STATUS = 'Open'
Can be written in the following way:
Select * From ${@table} where ${@column} = ${case_sts}
The values for the table, column and case_sts input arguments are passed to the Actor where they are translated into an SQL statement. When the Actor is called several times, if the resulting SQL is the same as in the previous run, the prepared statement is not recalculated.
The db-commands.flow example shows how the DbCommand Actor can be used to perform various DB actions, including:
Click Actions > Examples in the Main menu to open the db-commands.flow example.
The following example shows how to execute a SELECT statement which includes a WHERE clause using ordered params:
The parameters for the WHERE clause are transferred using the Const Actor's [values] object connected to the params input argument of the DbCommand Actor.
[
"San Diego",
"CA"
]
The following example shows how a SELECT statement is executed using named params:
When the above query is written in the sql input parameter, a new city_name input argument is added to the DbCommand Actor and the parameter is transferred to it.
The following example shows the SQL statement which includes parameters to populate the table and column name:
The new input arguments table, clm_name and clm_value are added to the SourceDbQuery Actor and are populated by 'cases', 'status' and 'Open' values respectively.
In this example, table and clm_name are non-prepared statement parameters while clm_value is a prepared statement named parameter.
The DbErrorHandlerBatch and DbFlushBatch Actors are introduced for error handling when working with a given DB interface in batch mode.
Note that to utilize batch error handling, the batch input argument of the DbCommand and DbLoad Actors should be set to true.
The following example illustrates the usage of the DbErrorHandlerBatch and DbFlushBatch Actors:

The inner flow, set on the DbErrorHandlerBatch Actor, is triggered in case of exception in the batch for each caught exception. The inner flow can receive the following input parameters:
In the inner flow, you can introduce the business logic that will define how to continue:
The below example illustrates the inner flow logic:

Broadway has a category of db Actors that are useful for performing DB commands and actions like creating a new table, loading data or fetching it and executing other DB commands. These Actors are:
Each Actor in the db category requires an interface input argument that can be defined either as a reference to the Fabric DB Interface or as a JDBC URL.
The schema, table, fields and sql input arguments of db Actors are case-insensitive.
Data writing Actors can work in a batch mode. When the batch input argument is set to true, the Actor accumulates statements and performs them as a batch for better performance. It needs to be run in a transaction and the errors are reported as the batch is committed (every X record or on commit). The default batch size is set to 1,000.
Starting from Fabric V8.2.3, the DbErrorHandlerBatch and DbFlushBatch Actors are introduced to set a batch error handler and define how to handle errors without failing the entire batch. See a detailed explanation and example further in this article.
If the DB command executed by the db Actor fails, the actual SQL statement is sent to the log file. For example:
Caused by: java.sql.SQLException: [SQLITE_CONSTRAINT] Abort due to constraint violation
(UNIQUE constraint failed: CONTRACT_COPY.CONTRACT_ID)
INSERT INTO "main"."CONTRACT_COPY" ("CUSTOMER_ID","CONTRACT_ID","CONTRACT_REF_ID") VALUES (?,?,?)
Using DbLoad Actor
To load the data using the DbLoad Actor, populate the Actor's input arguments as follows:
Using DbCommand Actor
Another way to load the data in a Broadway flow is by using the DbCommand Actor and writing the SQL INSERT statement in the sql input argument. The values to be populated in the table can be taken from the input arguments using the parameters. For example:
INSERT INTO DATA (TEXT) VALUES (${text} )
Where ${text} is replaced with the value of the text input argument in the prepared statement.
The DbCommand Actor’s sql input argument includes an SQL statement which is executed by the Actor. The SQL statement can be created dynamically using prepared and non-prepared statement parameters.
The syntax is:
? - for ordered parameters.
${param_value} - for named parameters.
${@param} - for non-prepared statement parameters.
The values of named parameters are taken from the Actor's input arguments or from the params input argument and only if it is a map. For ordered parameters, the params input argument should be an array or a single value (not a map).
For example, the SQL statement:
Select * From CASES where STATUS = 'Open'
Can be written in the following way:
Select * From ${@table} where ${@column} = ${case_sts}
The values for the table, column and case_sts input arguments are passed to the Actor where they are translated into an SQL statement. When the Actor is called several times, if the resulting SQL is the same as in the previous run, the prepared statement is not recalculated.
The db-commands.flow example shows how the DbCommand Actor can be used to perform various DB actions, including:
Click Actions > Examples in the Main menu to open the db-commands.flow example.
The following example shows how to execute a SELECT statement which includes a WHERE clause using ordered params:
The parameters for the WHERE clause are transferred using the Const Actor's [values] object connected to the params input argument of the DbCommand Actor.
[
"San Diego",
"CA"
]
The following example shows how a SELECT statement is executed using named params:
When the above query is written in the sql input parameter, a new city_name input argument is added to the DbCommand Actor and the parameter is transferred to it.
The following example shows the SQL statement which includes parameters to populate the table and column name:
The new input arguments table, clm_name and clm_value are added to the SourceDbQuery Actor and are populated by 'cases', 'status' and 'Open' values respectively.
In this example, table and clm_name are non-prepared statement parameters while clm_value is a prepared statement named parameter.
The DbErrorHandlerBatch and DbFlushBatch Actors are introduced for error handling when working with a given DB interface in batch mode.
Note that to utilize batch error handling, the batch input argument of the DbCommand and DbLoad Actors should be set to true.
The following example illustrates the usage of the DbErrorHandlerBatch and DbFlushBatch Actors:

The inner flow, set on the DbErrorHandlerBatch Actor, is triggered in case of exception in the batch for each caught exception. The inner flow can receive the following input parameters:
In the inner flow, you can introduce the business logic that will define how to continue:
The below example illustrates the inner flow logic:
