Creating an ASA Event Handler

An ASA event handler can be invoked manually by trigger event statements or automatically, based on an occurrence of system event conditions or fixed schedules.

To create an ASA event handler, you must have an ASA connection profile open.

  1. Under an ASA connection profile in Database Explorer, right-click the Events folder and select New Event to launch the Create Event Handler Skeleton wizard.

  2. In the Name field, enter the event name.

    The Preview window automatically begins generating the appropriate template code for your event handler.

  3. Select Disable Event to disable the event so that it does not execute when the scheduled time or triggering condition occurs. A trigger statement does not execute a disabled handler.

  4. From the Execution Location drop-down, specify where the event is to be executed:

    • ALL: The default value. All databases execute the event.

    • CONSOLIDATED: Restricts the databases at which an event is handled.

    • REMOTE: Restricts to remote sites the databases at which an event is handled.

  5. For Trigger Type, select an option:

    Trigger TypeProcedure
    Manual If you create an event handler without a schedule or system event to trigger it, it is executed only when triggered manually. Click Finish. The ASA scheduled event handler definition skeleton appears in SQL Editor.
    Schedule
    1. Click Next. The Provide the Schedule Information page appears.

    2. Click Add to display the Schedule page.

    3. In the Name field, enter the name of the schedule.

    4. Under the General tab, set the start time you want the event to trigger. Use the At button to specify an exact time, or select the Between button to enter a range within the day.

    5. Select Start Date, then click Change Date to display an Event Calendar dialog from which you can select a month and day, which must be greater than or equal to today's date. Click OK to return to the Schedule page.

    6. Under the Repeat tab, indicate how often the event should repeat. Select the Repeat Time check box to set the repeat frequency. Select Trigger Event On to choose the Day(s) of the Week option or the Days of the Month option. Use the scroll-down menus to select the days of the week or month you want the event to repeat.

    7. Click OK to complete the schedule. The Provide the Schedule Information page reappears. You can schedule more events by selecting Add and repeating the above process.

    8. When you are done specifying events, click Finish. The ASA scheduled event handler definition skeleton appears in SQL Editor.

    Condition
    1. Click Next. The Provide Optional Condition Information page appears.

    2. Select one of the predefined system events from the drop-down list above the table. (See the ASA documentation for detailed descriptions of system events.)

    3. Select the Condition and Operator from their respective drop-down lists. Enter the Value and click OK.

    4. When you are done adding conditions, click Finish. The ASA event handler definition skeleton appears in SQL Editor.

  6. In the Comments field, document the purpose and application of your stored procedure.

Creating an ASA Connection Profile

Adaptive Server Anywhere Database Administration Guide, Chapter 10, Automating Tasks Using Schedules and Events, in the Sybase WorkSpace Server Administration collection, Adaptive Server Anywhere 9.0.x.

Send your feedback on this help topic to Sybase Tech Pubs: pubs@sybase.com