SQLite on Android and MongoDB with sync

Is it possible to use SQLite on Android and a NoSQL database such as MongoDB on the server, with two-way data replication / synchronization between them? Or is it better to use either SQL at both ends, or NoSQL at both ends, but not mix?

+4
source share
2 answers

There are several different approaches to consider:

1) Use a database product that implements a multimaster or MVCC (Multiversion Concurrency Control) and runs on both Android + on your server. There are a few examples on the MVCC wikipedia page where CouchDB is a common solution. There is a TouchDB-Android port that is optimized to run on Android and supports replication to CouchDB.

2) Your requirements may be simple (or unique), sufficient to guarantee the implementation of your own decision. A common solution would be to use SQLite on Android and synchronize information with a remote server via an API (possibly RESTful).

It is not necessary to use the same database solution on both the mobile device and the server, but using a similar scheme and query language is likely to save you money.

+3
source

You can take a look at SymmetricDS , I have not used it myself, but I am considering it.

It currently allows SQLite DB on Android to sync with the mongoDB band, but currently not in the other direction. Apparently, you could create the necessary synchronization data in an intermediate synchronization database so that it returns to your SQLite database.

The pipeline also has a version of iOS.

It has a GPL, so you will have to pay (if your application is not open source) if you use it commercially.

+2
source

Source: https://habr.com/ru/post/1444904/


All Articles