cancel
Showing results for 
Search instead for 
Did you mean: 

SUP - Why invoke synchronize() method before setting synchronization parameter???

nicola_balloni
Explorer
0 Kudos

I tried to set the synchronization parameter to delimit the data to be transferred before invoke XXXXXDB.synchronize(). But i obtain an error:

"Error com.sybase.persistence.SynchronizeRequiredException: Illegal key generator status: the key generator must be populated first. "

My SUP version in 2.1.2

I have a lot of data to be transferred and the first synchronize takes too long. I don't know how to fix it, any ideas?

Regards,

Nicola.

Accepted Solutions (0)

Answers (1)

Answers (1)

nicola_balloni
Explorer
0 Kudos

Sorry, SUP version 2.1.3 !

Regards,

Nicola.

rakshit_doshi
Active Contributor
0 Kudos

Hi,

From you reply it seems that you are using it on Android devices.

Can you please brief on how exactly you are using the synchronization parameters in the code.

This error generally occurs when you try to use the database class without subscribe.

Did you try writing the synchronization parameter after subscribe() api.

Alternatively you can check if (......DB.issubscribed()) and then set the synchronization parameter if the condition is true and try to synchronize and see.

This should solve the problem.

Thanks,

nicola_balloni
Explorer
0 Kudos

Hi,

thanks for your reply!

This is my code, if I remove the XXXXXMboDB.synchronize() at line 33, the app throw the exception...

Application app = Application.getInstance();

XXXXXMboDB.registerCallbackHandler(new CustomerDBCallback());

XXXXXMboDB.setApplication(app);

 

XXXXXMboDB.getSynchronizationProfile().setServerName("192.168.6.18"); // Convenience only

ConnectionProperties connProps = app.getConnectionProperties();

LoginCredentials loginCredentials = new LoginCredentials(USERNAME, PASSWORD);

connProps.setLoginCredentials(loginCredentials);

connProps.setServerName("192.168.6.18");

connProps.setPortNumber(Integer.parseInt("5001"));

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

          Log.i("Tag", "@@@ START - Register application ");

          app.registerApplication(Integer.parseInt("30"));

          Log.i("Tag", "@@@ END - Register application ");

} else {

          Log.i("Tag", "@@@ START - Start application ");

          app.startConnection(Integer.parseInt("30"));

          Log.i("Tag", "@@@ END - Start application ");

}

if (!XXXXXMboDB.databaseExists()) {

          Log.i("Tag", "@@@ Database not exist ");

          XXXXXMboDB.createDatabase();

}

if (!XXXXXMboDB.isSynchronized("default")) {

          Log.i("Tag", "@@@ Database not sync ");

          XXXXXMboDB.disableChangeLog();

          XXXXXMboDB.synchronize();

          SynchronizationGroup sg = XXXXXMboDB.getSynchronizationGroup("default");

          sg.setEnableSIS(true);

          sg.setInterval(5);

          sg.save();

          CLIENTISynchronizationParameters sp = CLIENTI.getSynchronizationParameters();

 

          sp.setPar_livello1("%");

          sp.setPar_livello2("1234");

          sp.setPar_livello3("%");

          sp.setPar_livello4("ABCD");

          sp.setPar_livello5("%");

          sp.setPar_livello6("%");

 

          sp.save();

          XXXXXMboDB.synchronize();

}

XXXXXMboDB.enableChangeLog();

The method isSubscribed() is the same things of "(app.getRegistrationStatus() != RegistrationStatus.REGISTERED)"??