Skip to Content
Author's profile photo Ashish Rawat

Login/Registration with Sybase from any mobile devices for offline applications.

    This article tend to address  registration and login issue with Sybase. 

    There are two ways to sync with Sybase RBS and MBS.

    RBS is the replication based sync which is usually default available  for all devices except IOS. However from Sybase 2.1.3 IOS will also migrate to RBS.

    MBS (message BS) was only  supported for IOS. For details about replication methods you can see the following  link.

    As RBS is the way forward and all offline application are moving to it . I will summaries the way to login/connect using RBS.

    If you are trying to connect your Windows mobile /Android /IOS devices to sybase. Do it in following order.

  1. Registration.
  2. Registration occurs between SUP —–> Mobile devices.  In RBS scenario registration is auto. You not need to register user in Sybase server and use activation code. The only thing that need to be maintained in server is auto registration template. 

    Auto registration template should be maintained in such a way that it should give  unique result for your  input parameters.

    Eg if you have give “application id”  than there should be only one auto registration template for each application,  if you give “application id ”  and security configuration, then combination should be unique. 

    Most scenario of Login/Registration fails here. 

    Registration code for android devices  is a  follows. . app =;

    if (app.getApplicationIdentifier()== null)





    //connection properties

    ConnectionProperties profile = app.getConnectionProperties();





    //if user name pwd doesn’t work then create credential

    LoginCredentials logcred = new LoginCredentials(userid,password);



    //enable logs


    if (app.getRegistrationStatus()!= RegistrationStatus.REGISTERED)


    After execution of  the last line of above code, you must be able to see  an entry in  SCC-> application connections, showing your simulator or device id . This random number is generated by SCC and assigned to your device/simulator.  If you reregister the device again with different user, it will generate a different number for same device/simulator.

    One important thing to notice is same user can’t be registered with 2 devices for a give device type. Haven’t tried multiple devices for same user yet, so can’t comment.

  3. Authentication
  4. Once  a device is registered. It is by default authenticated., user need not to authenticate it twice.

    However for every subsequent  synchronization, user should open connection.

    if (app.getConnectionStatus()!=        ConnectionStatus.CONNECTED)


    However as our application should work in offline more in case of no network connection, you can use offlineauthentication method as well.

  5. Database Creation

    Once user is registered and authenticated, the  MBO database has to be created in device, the code is straight forward and self explanatory. Following is code for android device

    ConnectionProfile  conprof = SAPRetailExDB.getConnectionProfile();

    File dir = Environment.getExternalStorageDirectory();

    File yourFile = new File(dir, “RETAILEXECUTION/SAPRETAILEX10.ulj”);

    conprof.setProperty(“databaseFile”, yourFile+””);



    if (!SAPRetailExDB.databaseExists())



    Connection profile determine the database connection properties õf local database.

  7. Synchronization
  8. Once database has been created, user registered and authenticated, the final step is synchronization.

    For sync, first you need to maintain the synchronization profile, which unfortunately is also named as ConnectionProfile and adds to confusion(people tend to think it is same as connectionprofile) .

    However this profile is purely used for sync,  and its properties are prefilled from server, when user is registered.  Still it is safe to provide all possible value again manually

    ConnectionProfile syncProfile = SAPRetailExDB.getSynchronizationProfile();

    LoginCredentials cred = new LoginCredentials(userid,password);

    syncProfile.setCredentials(cred );






    Once synchronization profile is set the only thing pending is to set the personalization parameter and sync.  Personalization parameter is an important concept and has to be mandatorily given even if it  is not being used. It has to be saved blank for the MBO’s you have declared them in server.

    If personalization parameters are not maintained, the sync will fail, even if you are not using them.

    PersonalizationParameters pp =          SAPRetailExDB.getPersonalizationParameters();

    // Assign values to the PersonalizationParameters object:

    //String value =”002BC74DB9D8446FE10000000A428970″;

    String value = generateRandomId();

    pp.setSyncGuidPK( value);



    SAPRetailExDB.synchronize(“ActivitySyncGroup”, listener);

    Each of the above steps has more intricacies to it.  I have just jotted down the most common things to do to achieve the sync. However for each of above topic it is advised to read in great length in

    Happy Coding !!!!!

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Rakshit Doshi
      Rakshit Doshi

      Where is the offline login API used for Android. With the above code it is working well for online loigin but not for offline.

      Can you please elaborate as to how to login for Offline.


      Author's profile photo Ashish Rawat
      Ashish Rawat
      Blog Post Author

      Hi Rakshit,

      For offline login, if register application return true it is sufficient. Sybase store some file in client that validate that if registration  is successful even in case of offline.

      However if you have an explicit validation request, you may use <DatabaeName>.offlinelogin(<username>, <password>)

      Best Regards

      Ashish Rawat