android sqlite bidirectional synchronization sqlite

夙愿已清 提交于 2019-11-26 13:58:47

问题


I need to sync my Android SQLite DB with my cloud-server DB, and doing it in a bi-directional way in a multiuser environment.

I have found and introduction to the solution here but I would like to read about a better solution/algorithm.


回答1:


Can you use Oracle Database as your server-side DB?

If so, you should consider Oracle Database Lite, which includes a full synchronization solution that is compatible with SQLite and Android, and was designed for multi-user environments.

It supports automatic synchronization, advanced conflict resolution, and multiple sync models. It also supports deploying and managing apps from a central management console, and even device management.

You can read more about it here: http://www.oracle.com/technetwork/database/database-lite/overview/index.html

Also, you can click on the download tab to try it out for yourself.

Eric




回答2:


I'd recommend to send db file to your server and do merging on the server side. Then send merged db back to the client if needed. Your solution will vary based on conflict resolve algorithm and your database schema. But here is example for the simplest case:

sqlite> attach 'client.db3' as ClientDBtoMerge;           
sqlite> insert into TableName select * from ClientDBtoMerge.TableName;
sqlite> detach database ClientDBtoMerge; 

Hope you are be able to modify example for bi-directional merge.



来源:https://stackoverflow.com/questions/4008015/android-sqlite-bidirectional-synchronization-sqlite

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!