How to do bidirectional sync between Android SQLite and SQL Server - android

Hello, I want to know if there is any way to synchronize my SQLite database in Android to a SQL Server database in the main server in an automated way.
I'm new to Android development and I've been using SQL Server replication in the past with my Windows Mobile apps which provides me a lot of features like conflict detection and resolution. I want to know if there's something similar to SQL Server replication in Android or something like that.
Thanks for your help...

No, this cannot be done easily. There is, however, an alternative storage method like CouchDB which provides automatic synchronization with multiple other databases.

Related

Which type of database should I use?

I have a question about which database I should use for my android and iOS apps. I have not messed with servers before so please excuse my ignorance.
Anyways, I am developing apps for a website that doesn't have a mobile version. The website has a MySQL database and uses phpMyAdmin as a control panel.
I need to figure out how to hook into the server. I know that java provides full support for SQLite databases and I know that they server hosters can install SQLite on the server for me.
What do you all think? MySQL or SQLite?
You should be using SQLite for any local databases to the Android app (CoreData for iOS).
Any interaction with your websites MySQL database should be handled through API calls.
There is a good PHP framework called Slim PHP that will make building your API extremely simple. It's documented very well. Slim PHP doesn't offer any form of ORM so I'd also recommend integrating with Idiorm/Paris, again their documentation is rather good so you shouldn't have a problem piecing this all together.
Of course you can opt for a larger PHP framework that has all of this in one place, such as Symfony.

SQLite on Android and MongoDB with synchronization

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.
You may want to take a look at SymmetricDS, I haven't used it myself but I'm considering it.
It currently allows a SQLite DB on Android to sync to a mongoDB backend but currently not in the other direction. Apparently you could create the necessary sync data into the intermediary sync'ing DB for it to work back to your SQLite DB.
There is also an iOS version in the pipeline.
It has a GPL licence so you'll need to pay (unless your app is open source) if you use it commercially.

Local DB on Android sync to backend server? What are the options?

Local DB always sync to remote server sounds a great idea, because you get the responsiveness for using local DB, but also get sync crossing devices.
But can anybody talk about their experiences with couchbase on Android?
https://github.com/couchbase/Android-Couchbase/
What are other options out there? Cloudant?
Look at Touch-DB Android. It's more compact than Android-Couchbase and is still regularly updated and maintained (I believe the main contributor is working on a big release, which is why the last update we two months ago). The framework is built on top of Ektorp and emulates a CouchDB database on your Android device.
Replication to and from a remote database is fairly intuitive and easy to set-up.
I use CloudAnt as my remote back end for my Android game.
I can tell you that in general, it works. e.g. I have an android app that syncs with iriscouch.com. But you might want to ask a more specific question.
iBoxDB is another option. It is a lightweight database for java. You can customize replication.
https://github.com/iboxdb/forjava

What databases/datastores have client data sync support for iOS and Android?

It seems most apps are writing custom logic to sync/replicate cloud data, or using a platform locked service like iCloud.
What cross platform data sync solutions are out there besides roll your own? By "solution" I mean well tested combinations of server and client components.
The two I know of are:
CouchBase Mobile (CouchDB on server, CouchDB on device)
Microsoft Sync Framework (SQL Server on server, SQLite on device)
I know these are quite different data stores, but any data solution that is generalized for many problem types could potentially reduce some wheel reinventing. For example I may need NoSQL for one app and relational for another.
Any other options besides these two?
Sybase SQL Anywhere Studio has UltraLite database as a part.
This database has versions running on iOS, Android, Blackberry, and lets you synchronize through HTTP/HTTPS

Is it possible to use Couch DB or MySql or any other DB in Android?

We know that Android uses SQLite as its default database. My question is: Is it possible to replace this by CouchDB or MySql or any other database and successfully run it? Has anybody done this? I went through What are requirements to use CouchDB on Android?, and other questions in SO, but I'm not completely clear about it. It does seem possible to install CouchDB on Android, but as an app. I want to know if it's possible to replace SQLite with Couch or MySql or any other DB.
Any help will be highly appreciated. Thanks in advance.
You can indeed use CouchDB on Android.
Here's a video discussing CouchDB http://www.youtube.com/watch?v=3RdcKWYGqig
You will need an external SD card. It runs as a service so you can have multiple apps using CouchDB. It also has amazing replication capabilities. So if you need to sync with a master database then COuchDB makes this very easy.
There is more information available in this answer https://stackoverflow.com/a/4956789/808940
There are also some tutorials available on the web but to get started you can download the CouchDB app from Android Marketplace.
db4o runs on android, although it's an OODB, not an RDBMS. I suspect some Java-only DBs would run; Derby didn't at one point, H2 has at least some early support.
AFAIK, there is no other database you can use in android.

Categories

Resources