Handling errors and warnings in event hook procedures

You can create event hook stored procedures to handle synchronization errors, MobiLink connection failures, and referential
integrity violations. This section describes event hook procedures that are used to handle errors and warnings. Once implemented,
each procedure is automatically executed whenever an error of the named type occurs.

Handling RI violations

Referential integrity violations occur when rows in the download violate foreign key relationships on the remote database.
Use the following event hooks to log and handle referential integrity violations:

Handling MobiLink connection failures

The sp_hook_dbmlsync_ml_connect_failed event hook allows you to retry failed attempts to connect to the MobiLink server using
a different communication type or address. If connection ultimately fails, dbmlsync calls the sp_hook_dbmlsync_communication_error
and sp_hook_dbmlsync_all_error hooks.

Handling dbmlsync errors

Each time a dbmlsync error message is generated, the following hooks are called:

First, depending on the type of error, one of the following hooks is called: sp_hook_dbmlsync_communication_error, sp_hook_dbmlsync_misc_error,
or sp_hook_dbmlsync_sql_error. These hooks contain information specific to the type of error; for example, sqlcode and sqlstate
are provided for SQL errors.

Next, sp_hook_dbmlsync_all_error is called. This hook is useful for logging all errors that occur.

Ignoring errors

By default, synchronization stops when an error is encountered in an event hook procedure. You can instruct the dbmlsync utility
to ignore errors that occur in event hook procedures by supplying the -eh option.