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

SQL Anywhere 17 » MobiLink - Server Administration » MobiLink events » Synchronization scripts » Script parameters

Authentication parameters

In MobiLink scripts, authentication parameters can be specified using named parameters.

If named parameters are used, the authentication parameters must be prefaced with the letter a, such as {ml a.1}. The parameters must be numbers starting at 1, with a limit of 255. Each parameter can be a maximum of 4000 bytes. The values are sent up from MobiLink clients.

When used in the authenticate_* scripts, authentication parameters pass authentication information.

Authentication parameters can be used in all other events (except begin_connection and end_connection) to pass information from MobiLink clients. This technique is a convenient way to do something that you could otherwise do by uploading rows to a table. With authentication parameters the values are available prior to the table's upload events.

On SQL Anywhere remotes, you pass the information with the dbmlsync -ap option. On UltraLite remotes, you pass the information with auth_parms and num_auth_parms.


For UltraLite remote databases, pass the parameters using the num_auth_parms and auth_parms fields in the ul_sync_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. During synchronization the authentication parameters are obfuscated in the same way as passwords. If num_auth_parms is 0, set auth_parms to null. The 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 authentication 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"

On the server, you reference the authentication parameters using the order in which they were sent up. 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}