JDBC Update is an asynchronous activity that performs the specified SQL INSERT, UPDATE, or DELETE statement.
If this activity is not part of a transaction group, the SQL statement is committed after the activity completes. If this activity is part of a transaction group, the SQL statement is committed or rolled back with the other JDBC activities in the group at the end of the transaction.
If you want to override the default behavior of transaction groups for certain JDBC activities in a transaction group, you can select the Override Transaction Behavior check box on the Advanced tab. This specifies that the activity is outside of the transaction and the SQL statement is committed when the activity completes, even if the activity is in a transaction group.
The SQL statement is committed after the activity completes.
The General tab has the following fields.
|Field||Literal Value/Module Property?||Description|
|Name||None||The name to be displayed as the label for the activity in the process.|
|JDBC Shared Resource||Yes||The path to the shared resource containing the JDBC connection information.
For details, refer to JDBC Connection.
|Timeout||Yes||The time (in seconds) to wait for the query to complete. If the query does not complete in the given time limit, an error is returned.|
The Statement tab has the following fields.
|Statement||This is an SQL INSERT UPDATE OR DELETE statement to perform in the database. You can use the SQL Builder wizard to build the query for the desired database.|
Prepared Statement contains the
Parameter Name and
Datatype fields. All the parameters defined in the
Prepared Statement table are shown in the
Input tab of the activity for the user to provide values.
Each prepared statement corresponds to the question mark in the same position in the SQL statement. That is, the first prepared statement in the list corresponds to the first question mark, the second prepared statement in the list corresponds to the second question mark, and so on. The warning is for informational purposes only, you must make sure the parameters in this field correctly correspond to the statement.
The Advanced tab has the following fields.
|ThreadPool SharedResource||Specifies a queue of threads available to run a queue of tasks. Thread pools are used to improve performance when executing large numbers of asynchronous tasks by reducing per task invocation overhead, provide a means of bounding, and managing the resources consumed when executing a collection of tasks.|
|Insert if record doesn't exist||Select this check box to insert the record if it does not exist in the database.|
|Override Transaction Behavior|| Overrides the default behavior of a transaction group. If this activity is in a transaction group, the activity is normally committed or rolled back with the other transactional activities.
If you select this check box, this activity is not part of the transaction group and is committed when it completes. Selecting this option uses a separate database connection to perform the activity and commit the SQL statement.
|Override JDBC Connection||Selecting this option overrides the default datasource connection, and allows for SQL queries to be executed against the optional datasource.
After selecting this option, the sharedResourceName field is enabled under the Input > Data Source tab. From the sharedResourceName field, type the complete path with the name of the optional datasource, which can be found under the Resources folder. For example, if a JDBC shared resource is located at Resources > Package_Name > JDBC_SR_Name, then the value you enter should be Package_Name.JDBC_SR_Name. The value you enter in the XPath Expression field is case sensitive and must be a string.
|Interpret Empty String as Null||Specifies how empty strings in the activity’s input elements should be handled.
Selecting this check box sends the nulls to the database where empty strings are supplied.
When the check box is not selected, empty strings are treated as zero-length strings. Whether you use this check box option or not, you can still use XPath to set input elements explicitly to null.
Selecting this check box signifies that you want to perform multiple statements by supplying an array of records as input to the activity where each record matches the prepared parameters for the statement. The statements are performed in one batch at the end of the activity’s execution.
If you do not select this check box, the expected input is the list of prepared parameters for the statement (no array of records). Some database drivers may not support batch updates. A JDBCSQLException is thrown, if the database driver does not support batch updates.
The following is the input for the activity.
The following is the output for the activity.
The Fault tab lists the possible exceptions thrown by this activity. See Error Codes for more information about error codes and the corrective action to take.
|JDBCConnectionNotFoundException||An error occurred when attempting to connect to the specified database.|
|InvalidTimeZoneException||An invalid time zone was specified.|
|JDBCSQLException||An SQL error occurred.|
|LoginTimedOutException||A timeout has occurred while attempting to connect to the database.|
|InvalidSQLTypeException||A parameter’s datatype does not match the datatype of the table column.|
|ActivityTimedOutException||The operation has timed out.|