Use this stored procedure to retry failed attempts to connect to the MobiLink server using a different communication type or address.
Name | Value | Description |
---|---|---|
publication_n (in) |
publication |
Deprecated. Use subscription_n instead. The publications being synchronized, where n is an integer. There is one publication_n entry for each publication being synchronized. The numbering of n starts at zero. |
MobiLink user (in) |
MobiLink user name |
The MobiLink user for which you are synchronizing. |
script version (in) |
script version name |
The MobiLink script version to be used for the synchronization. |
connection address (in|out) | connection address | When the hook is invoked, this is the address used in the most recent failed attempt to connect. You can set this value to a new connection address that you want to try. If retry is set to true, this value is used for the next attempt to connect. For a list of protocol options, see MobiLink client network protocol option summary. |
connection type (in|out) | network protocol | When the hook is invoked, this is the network protocol (such as TCPIP) that was used in the most recent failed attempt to connect. You can set this value to a new network protocol that you want to try. If retry is set to true, this value is used for the next attempt to connect. For a list of network protocols, see CommunicationType (ctp) extended option. |
user data (in|out) | user-defined data | State information to be used if the next connection attempt fails. For example, you might find it useful to store the number of retries that have occurred. The default is an empty string. |
allow remote ahead (in|out) | true | false | This is true only if the dbmsync -ra option or the RemoteProgressGreater=on synchronization profile option was specified for this synchronization. By changing the value of this row, you can change the value of the option for the current synchronization only. See -r dbmlsync option. |
allow remote behind (in|out) | true | false | This is true only if 23. the dbmsync -ra option or the RemoteProgressLess=on synchronization profile option was specified for this synchronization. By changing the value of this row, you can change the value of the option for the current synchronization only. See -r dbmlsync option. |
retry (in|out) | true | false | Set this value to true if you want to retry a failed connection attempt. The default is FALSE. |
subscription_n (in) | subscription name(s) | The names of subscriptions being synchronized where n is an integer. This is one subscription_n entry for each subscription being synchronized. The numbering of n starts at zero. |
If a procedure of this name exists, it is called if dbmlsync fails to connect to the MobiLink server.
This hook only applies to connection attempts to the MobiLink server, not the database.
When a progress offset mismatch occurs, dbmlsync disconnects from the MobiLink server and reconnects later. In this kind of reconnection, this hook is not called, and failure to reconnect causes the synchronization to fail.
Actions of this procedure are committed immediately after execution.
This example uses the sp_hook_dbmlsync_ml_connect_failed hook to retry the connection up to five times.
CREATE PROCEDURE sp_hook_dbmlsync_ml_connect_failed () BEGIN DECLARE idx integer; SELECT IF value = ''then 0 else cast(value as integer)endif INTO idx FROM #hook_dict WHERE name = 'user data'; IF idx < 5 THEN UPDATE #hook_dict SET value = idx +1 WHERE name = 'user data'; UPDATE #hook_dict SET value = 'TRUE' WHERE name = 'retry'; END IF; END; |
The next example uses a table containing connection information. When an attempt to connect fails, the hook tries the next server in the list.
CREATE TABLE conn_list ( label INTEGER PRIMARY KEY, addr VARCHAR( 128 ), type VARCHAR( 64 ) ); INSERT INTO conn_list VALUES ( 1, 'host=server1;port=91', 'tcpip' ); INSERT INTO conn_list VALUES ( 2, 'host=server2;port=92', 'http' ); INSERT INTO conn_list VALUES ( 3, 'host=server3;port=93', 'tcpip' ); COMMIT; CREATE PROCEDURE sp_hook_dbmlsync_ml_connect_failed () BEGIN DECLARE idx INTEGER; DECLARE cnt INTEGER; SELECT if value = ''then | else cast(value as integer)endif INTO idx FROM #hook_dict WHERE name = 'user data'; SELECT COUNT( label ) INTO cnt FROM conn_list; IF idx <= cnt THEN UPDATE #hook_dict SET value = ( SELECT addr FROM conn_list WHERE label = idx ) WHERE name = 'connection address'; UPDATE #hook_dict SET value = (SELECT type FROM conn_list WHERE label=idx) WHERE name = 'connection type'; UPDATE #hook_dict SET value = idx +1 WHERE name = 'user data'; UPDATE #hook_dict SET value = 'TRUE' WHERE name = 'retry'; END IF; END; |
Discuss this page in DocCommentXchange.
|
Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 |