Defining DB Event Objects
DB Event objects check in defined intervals whether certain database conditions apply. They include the definition of two values to be compared to each other and, if the condition matches, the event specified on the Event Process page is triggered in the defined intervals. This event, in turn, triggers other tasks or workflows.
You define DB Event objects on two pages:
-
Database Event
Here you define the values to be compared.
-
Event Process
This is the core of Event objects. You specify here the statements that are processed as soon as the defined conditions are met.
To Define DB Event Objects
-
Define the values to be compared.
On the Database Event page you define the two values that should be compared and the operator that compares them.
Three sources can provide the values:
-
SQL Query
You can use Object variables within an SQL query. The database event does not abort if the query is incorrect.
- In Source select SQL Query to display the SQL-specific input fields.
-
In SQL click the file icon on the right hand side to open the Cell Editor, where you can enter the SQL query.
Click OK.
-
In Agent enter the name of the database agent that processes the query. It can be up to 4096 characters long.
Agent groups cannot be selected in database events
- In Login select the object that contains the necessary information for the event to be able to log on to the system.
-
In Server:Port enter the name of the computer on which the database is available, for example PC01:2281.
The default ports are:
- MS SQL Server: 1433
- Oracle: 1521
- DB2: 50000
- MySQL: 3306
Do not complete this field if the query should be made in an Oracle database in RAC.
- In Database enter the name of the database.
- In MS Access Filename enter the path and file name of the MS Access database.
-
Static Value
Enter any value; It can contain up to 40 characters.
-
Variable
- In Variable Object select the name of the Variable object that contains the string to compare.
- In Variable key select the entry in the Variable object to be used for the comparison.
The database event is not activated if the key does not exist in the specified Variable object.
If the key does not include a value, the result depends on the setting that has been defined on the Attributes Pages of Executable Objects of the Variable object. The system either logs an error message or uses the initial values. The database event does not abort.
See GET_CONSOLE, GET_EVENT_INFO for details on the syntax of event handling scripts.
-
-
Compare the values.
Select the Operator to use in the comparison. The following options are available:
- > Greater than
- < Less than
- = Equal to
- != Not equal to
- >= Greater than or equal to
- <= Less than or equal to
- Contains
You can combine values as necessary. Values are interpreted and compared as string values; if both values can be interpreted as positive integers (>=0), they will be compared as integer values.
For example:
5 > 1: Values are interpreted as positive integers -> int 5 > int 1 -> true
1 > -1: Values are interpreted as strings -> string "1" > string "-1" -> false
Fractional digits are truncated. To prepare them for comparison first read the values on the Event Process page using the GET_EVENT_INFO script function and then multiply them with 10n in order to move the commas.
For example:
4 * 100 (corresponds to 102) = 12344
123.5555 * 10000 (corresponds to 104) = 12355555
Time stamps of SQL queries and Variable objects are converted to "YYYY-MM-DD HH:MM:SS".
-
Define the Time Parameters.
-
In Frequency you have the following options to determine how often the event object should be activated:
-
Once
It is activated only once.
-
Repeatedly
It is activated periodically, depending on the setting you define below.
-
Repeat until first match
It is activated until the specified conditions applies.
-
-
In Check Frequency you specify when the event object will be activated:
-
Activate the In intervals of ... minutes to define a periodicity and enter or select the interval.
The First Check options are displayed, where you further configure when the intervals should begin:
-
Immediately
The Event object becomes active for the first time upon its activation, regardless of the specified time interval.
-
After the first interval
The Event object becomes active for the first time after the expiration of the first time interval.
-
-
Activate At to define a specific time and enter it.
The If start time is later options are displayed, where you further configure when the event should be activated:
-
Activate immediately
If the Event object starts after the specified time, it becomes active immediately.
-
Wait for the next valid date
If the Event object starts after the specified time, it becomes active with the next valid date considering the calendar and time conditions you specify below.
-
Some of the settings specified here can be read at runtime. Script elements are used to access the attributes of this object.
-
-
-
Define the Time and Date Conditions.
- Click the first row to activate it and, in the Calendar column select an entry from the dropdown list.
- Select the Calendar Event you want to apply.
-
To edit a row you must first click its checkbox to activate it. You have then the following options:
To add/edit a row you must first click its checkbox to activate it. You have then the following options:
Option Description
Inserts a new row at the bottom of the table
Deletes the row Removes the entry from the list and pastes it to the clipboard. Click Paste to add it to the bottom of the table. Duplicates the entry. Click Paste to add it to the bottom of the table. Activates all rows in the table.
-
Switch to the Event Process page to enter the script to be processed every time the event occurs:
A database event process cannot contain JCL lines.
Next steps:
Executing the Object
Event objects can be included in Schedule Objects (JSCH) and thus be executed automatically at predefined times and/or intervals. Likewise, they can be part of workflows (see Workflow Definition — Overview).
Of course, you can also manually execute, restart or stop them. For details see Executing Event Objects.
Monitoring the Event
Immediately after executing the object you can start monitoring it. Right-click it to select Monitoring and open the pre-filtered list of tasks to display this one. See Working with Tasks.
Working with Task Events
In the Process Monitoring perspective you can then follow their progress and access the reports and statistical information associated to them. See Working with Tasks.
See also: