MobiLink Synchronization User's Guide
Authenticating MobiLink Users
About MobiLink users
Creating MobiLink users
If you want two or more remote databases (UltraLite or Adaptive Server Anywhere) to share the same MobiLink user name, then you can create a MobiLink user name that is a base name with a unique suffix. You do this in the CREATE SYNCHRONIZATION USER statement by adding a + after the user name, followed by your suffix.
A typical use of this technique is for a person who wants to have several remote databases. Each remote database must have a unique MobiLink user name, but they can share the same base name.
The following example creates MobiLink user names that are 102 followed by a colon and a UUID.
BEGIN EXECUTE IMMEDIATE 'CREATE SYNCHRONIZATION USER "102' + ':' + UUIDTOSTR(NEWID()) + '"'; END;
This creates a MobiLink user name such as 102:b23fdbed-bead-418a-9d53-917e774c2f4f.
You still need MobiLink to provide the user name to each of the MobiLink scripts. To do this, you can use a MobiLink event called modify_user. It takes the MobiLink user as input and allows you to modify it. The modified value is what is passed to all the download events. For example,
CALL sp_ML_modify_user( ? )
The result is that the following download_cursor is based on the value of 102, not 102:b23fdbed-bead-418a-9d53-917e774c2f4f.
Select emp_id, emp_name From ULEmployee Where last_modified > ? And emp_id = ?
Here is the procedure written using Adaptive Server Anywhere syntax. This can easily be converted for other RDBMSs.
CREATE PROCEDURE sp_ML_modify_user( INOUT @ml_user_name VARCHAR(255) ) BEGIN DECLARE @colon_at INT; SET @colon_at = LOCATE( @ml_user_name, ':' ); IF( @colon_at > 0 ) THEN -- Message statements are displayed in the minimized engine -- window, this is useful for debugging
MESSAGE 'UUID: ' + RIGHT( @ml_user_name, (LENGTH(@ml_user_name)-@colon_at) ); SET @ml_user_name = LEFT( @ml_user_name, (@colon_at-1) ); MESSAGE 'New MobiLink User: ' + @ml_user_name; ELSE MESSAGE 'No change to MobiLink User: ' + @ml_user_name; END IF; END;