An error in a synchronization script occurs when an operation in the script fails while the MobiLink server is executing it. For SQL scripts, the DBMS returns a SQLCODE and error message to the MobiLink server indicating the nature of the error. Each consolidated database DBMS has its own set of SQLCODEs and messages. By default, the MobiLink server rolls back the transaction in the consolidated database, logs the error, and aborts the synchronization.
When an error occurs during the invocation of a SQL data script, the MobiLink server invokes the handle_error or handle_odbc_error events. When these error-handling scripts are defined, the MobiLink server invokes them and passes several parameters providing information about the nature and context of the error. One parameter is an output value, called the action_code, to tell MobiLink server how to respond to the error. The action_code tells the MobiLink server to either ignore the error or abort the synchronization.
The error-handling scripts do not get invoked for all SQL errors. Only data scripts cause the error-handling scripts to be invoked. When errors occur in non-data scripts, the MobiLink server rolls back the transaction in the consolidated database, logs the error, and aborts the synchronization.
If your consolidated DBMS supports exception handling, consider using it instead of the error-handling scripts—particularly if you need to ignore certain errors in data scripts. Using exception handling will almost always perform better than the error-handling scripts.
If the handle_error or handle_odbc_error script itself causes an error, the MobiLink server rolls back the transaction in the consolidated database, logs the error, and aborts the synchronization.
Discuss this page in DocCommentXchange.
|Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1|