Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.0 » MobiLink - Server Administration » MobiLink Events » Synchronization events


authenticate_parameters connection event

Receives values from the remote that can be used to authenticate beyond a user ID and password. The values can also be used to arbitrarily customize each synchronization.


In the following table, the description provides the SQL data type. If you are writing your script in Java or .NET, you should use the appropriate corresponding data type. See SQL-Java data types and SQL-.NET data types.

In SQL scripts, you can specify event parameters by name or with a question mark, but you cannot mix names and question marks within a script. If you use question marks, the parameters must be in the order shown below and are optional only if no subsequent parameters are specified (for example, you must use parameter 1 if you want to use parameter 2). If you use named parameters, you can specify any subset of the parameters in any order.

Parameter name for SQL scripts Description Order
s.authentication_status INTEGER. This is an INOUT parameter. 1
s.remote_id VARCHAR(128). The MobiLink remote ID. You can only reference the remote ID if you are using named parameters. Not applicable
s.username VARCHAR(128). The MobiLink user name. 2
a.N (one or more) VARCHAR(128). For example, named parameters could be a.1 a.2. 3...
Parameter Description
  • authentication_status   The authentication_status parameter is required. It indicates the overall success of the authentication, and can be set to one of the following values:

    Returned Value authentication_status Description
    V <= 1999 1000 Authentication succeeded.
    1999 < V <= 2999 2000 Authentication succeeded, but password expiring soon.
    2999 < V <= 3999 3000 Authentication failed as password has expired.
    3999 < V <= 4999 4000 Authentication failed.
    4999 < V <= 5999 5000 Authentication failed as user is already synchronizing.
    5999 < V 4000 If the returned value is greater than 5999, MobiLink interprets it as a returned value of 4000 (authentication failed).

  • username   This parameter is the MobiLink user name. VARCHAR(128).

  • remote_ID   The MobiLink remote ID. You can only reference the remote ID if you are using named parameters.

    See Using remote IDs and MobiLink user names in scripts.

  • remote_parameters   The number of remote parameters must match the number expected or an error results. An error also occurs if parameters are sent from the client and there is no script for this event.


You can send strings (or parameters in the form of strings) from both SQL Anywhere and UltraLite clients. This allows you to have authentication beyond a user ID and password. It also means that you can customize your synchronization based on the value of parameters, and do this in a pre-synchronization phase, during authentication.

The MobiLink server executes this event upon starting each synchronization. It is executed in the same transaction as the authenticate_user event.

You can use this event to replace the built-in MobiLink authentication mechanism with a custom mechanism. You may want to call into the authentication mechanism of your DBMS, or you may want to implement features not present in the MobiLink built-in mechanism.

If the authenticate_user or authenticate_user_hashed scripts are invoked and return an error, this event is not called.

SQL scripts for the authenticate_parameters event must be implemented as stored procedures.

See also

For UltraLite remote databases, pass the parameters using the num_auth_parms and auth_parms fields in the ul_synch_info struct. num_auth_parms is a count of the number of parameters, from 0 to 255. auth_parms is a pointer to an array of strings. To prevent the strings from being viewed as plain text, the strings are sent in the same way as passwords. If num_auth_parms is 0, set auth_parms to null. Following is an example of passing parameters in UltraLite:

ul_char * Params[ 3 ] = { UL_TEXT( "param1" ), 
   UL_TEXT( "param2" ), UL_TEXT( "param3" ) };

info.num_auth_parms = 3;
info.auth_parms = Params;

For SQL Anywhere remote databases, you pass parameters using the dbmlsync -ap option, in a comma-separated list. For example, the following command line passes three parameters:

dbmlsync -ap "param1,param2,param3"

In this example, the authenticate_parameters script could be:

CALL my_auth_parm ( 
  {ml s.authentication_status},
  {ml s.remote_id},
  {ml s.username},
  {ml a.1},
  {ml a.2},
  {ml a.3}