具有同步功能的Android和MongoDB上的SQLite [英] SQLite on Android and MongoDB with synchronization

查看:60
本文介绍了具有同步功能的Android和MongoDB上的SQLite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Android上使用SQLite,在服务器上使用像MongoDB这样的NoSQL数据库,并在两者之间进行双向数据复制/同步?还是最好是在两端都使用SQL,还是在两端都使用NoSQL,但不要混合使用?

解决方案

有几种不同的方法可供考虑:

1)使用可实现多主服务器或MVCC(多版本并发控制)的数据库产品,并且可在Android +服务器上运行. MVCC维基百科页面中有一些示例,其中CouchDB是常见的解决方案.有一个 TouchDB-Android 端口,该端口经过优化可在Android上运行,并支持复制到CouchDB. /p>

2)您的要求可能很简单(或独特),足以保证推出您自己的解决方案.一种常见的解决方案是在Android上使用SQLite并通过(可能是RESTful)API将信息同步到远程服务器.

在移动设备和服务器上使用相同的数据库解决方案不是必需的,但是使用类似的架构和查询语言可能会使您保持清醒.

Is it possible to use SQLite on Android and a NoSQL database like MongoDB on the server, with 2-way data replication/synchronization between the two? Or is it best to either use SQL on both ends, or NoSQL on both ends, but not mixed?

解决方案

There are a few different approaches to consider:

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

2) Your requirements may be simple (or unique) enough to warrant rolling your own solution. A common solution would be using SQLite on Android and syncing information to a remote server over a (probably RESTful) API.

It is not essential to use the same database solution on both mobile device and server, but using a similar schema and query language will probably keep you saner.

这篇关于具有同步功能的Android和MongoDB上的SQLite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆