Database synchronization alternatives - android

We currently have a centralized database (MySQL) where some data is loaded. Then we have a lot of Android devices with a copy of this database (SQLite). Our dynamic is to deliver every change/event made in the server database to our clients, Android devices. And of course capture all the transactions made by the clients and take them to the server in a consistent way.
Our current solution is an adaptation of SymmetricDS. We would like to explore some other solutions for this synchronization task.
We are looking for a synchronization method that provides the following features:
The ability to work offline mode (Our android clients won’t have access to the network all the time).
General purpose (an easy way to include some new model/tables)
Any Ideas?

Given your constraints of MySQL and Android-based SQLite, I haven't seen many alternatives. Oracle Mobile server comes close, but does not support MySQL, and it uses data comparison which can be more intensive with large datasets than data capture. Pervasync supports your databases as well as Android, but it's not open source like SymmetricDS. Have you discussed with the SymmetricDS project or JumpMind about what's lacking, because I'm sure they'd like to improve it.

Related

Couchbase lite querying and filtering

I was just testing couchbase lite on android (using xamarin).
Maybe it is a repeated question; is couchbase lite made to be a NoSql alternative for SQLite or it is a small couch that is optimized for syncing with the main couchbase database?
Querying is done by views(indexes) and they seems to be static searches using constants which have small changes at all.
For example can I use it with an autocomplete text or a search with data that users enter during the runtime?. N1QL seems to be a way to do this but it is not planned to be brought to mobile.
If I haven't used it in a correct way or I didn't understand couchbase mechanism, please tell me.
N1QL seems to be a way to do this but it is not planned to be brought to mobile.
Actually, this is one of the features of 2.0. It is not N1QL exactly but it is meant to be as close as we can get to it. You can see some examples of the syntax in the tests. Ignore the stuff on top (model) because that will apply to later 2.x releases and focus on the stuff that starts with Query.Select
As for the other things, you can use Couchbase Lite for a fully offline database as a NoSQL alternative to using SQLite directly if you wish. You can also use it to sync with Couchbase Server which is where a lot of the real power comes from!

What is best way to using Elastic search for searching (Via Server vs Direct Java Client)?

I am new to Elasticsearch. I want to store documents of products details. Now I am using Mongodb as my database and nodejs server. But Mongodb does not have good search functionalities like Elasticsearch.
So I am thinking of shifting to ES. But I have few doubts as stated below please suggest me what should I do. Any suggestion will be appreciated.
Should I use MongoDb as my primary database for storing documents and ES as secondary database just for doing efficient search. Or Should I make ES as my only database for storing documents and searching.
Does using both will be good for future or it will make thing difficult to manage. I have also read that ES in not a good choice for main database as it sometimes loses write operation.
Should I make a server in nodejs to perform ES operations for doing any complex search or GET, PUT using rest api or should I do it directly implement it in java .
(Note I am making a android app so should I use TransportClient and Interact with Elasticsearch directly or I should first send a GET request from android side to my server and my nodejs server will interact with ES and send response to my android app).
Other than search part is ES performs as good as MondoDb in terms of Database.
Thanks in advance.
I am risking an opinionated answer here. However I'll try to help you out:
I am using elasticsearch as a primary data store in cases the data is not that important or just to big to have it duplicated. If you have things like logs you could also keep the original logs files around. By default I would say, use a different database as primary store, that way you can always rebuild elastic if you want to make changes to your search index.
Adding components to your infrastructure makes it more work to manage. So adding MongoDB as well as Elastic does mean more moving parts. However, it also gives you more flexibility. I would not be to much afraid unless what you are searching for is very basic and can be done with MongoDB as well.
I advice to always have an application in front of your search engine. Treat it like a database, you would not expose that to the world.
I would not use a Transport Client in your Android app. That would mean a security risk. You want to make a connection to your backend as mentioned in 3 and let that application connect to your search cluster.
Hope that helps

How to make an android app work in offline mode in android

I want to know how i can make my app work in offline mode and store the data on a local database on the android device.
I am using mongodb database and fetching the data by using JSON Parsing.
What should i use to make my app run in offline mode and also update the changes made on the server ?
Which tools should i use ,also which is the best and easy method to implement this?
Thanks in advance.
first you create local SQLite Date Base
in that create one extra column like "noNet" ...
In this column you save your data when phone in offline mode and then send data to web server when phone is online
This question is a bit older now, but I'd like to add what I believe is a good architecture approach to solving this.
Take a look at the tech talk given by Yigit and Adam at the Android Dev summit. https://plus.google.com/+AndroidDevelopers/posts/3C4GPowmWLb
Seems the core components are:
Job Scheduler/Queue, via https://github.com/yigit/android-priority-jobqueue
DBFlow to make interaction with the SQLite database easier: https://github.com/Raizlabs/DBFlow
And an EventBus https://github.com/greenrobot/EventBus to easily broadcast when the actual jobs complete (so the UI and other components can be notified).
Those 3 together get you most of what you will probably need. Their tech talk (first link above) really details these things better, and there's a final example application you can take a look at as well: https://github.com/yigit/dev-summit-architecture-demo
If you have an option, you can go for couchdb or couchbase which provide couchlite for android and sync is taken care by itself.
you can also refer this thread here SQLite on Android and MongoDB with synchronization

Android Sync Sqlite

I am making a dictionary kind of an app which uses SQLite. I have a single table that keeps the pair of foreign words and their translations. I want to sync this table with a particular spreadsheet in Google Docs.
I ve found this awesome library to retrieve and manipulate GoogleSpreadsheets, so at least I am covered for that. But I donT feel comfortable about the sync. Now,
Can I use a SyncAdapter to do this sync between my SQLite and a GoogleSpreadsheet? If yes, how would I go about it? Would I retrieve and manipulate the rows of the spreadsheet in the onPerformSync or smth?
What could be the other alternatives for such a scenario? Should I maybe use a normal service to do the check when the user requests it (in the main activity, for example) ?
On the Google I/O vids (particularly on Android REST client apps ) they seem pretty persuasive for using the SyncAdapter but I am not sure if it could help me without an actual REST service.
Thanks in advance..
One good reason to use the Android SyncAdapter, ContentProvider and SyncManager is that you will benefit from the Google system knowledge that is useful for preserving battery life and other resources. Some of this content is in the video you link to. For example, exponential back-off logic to prevent wasteful attempts at synchronizing.
There is some good info about battery life preservation by conserving cell radio power in today's Google I/O 2012 talk "Making Good Apps Great: More Advanced Topics for Expert Android Developers." While not mentioned explicitly, I think that the SyncManager is likely to have the battery conserving properties that are mentioned in this video.
Based on my reading (not actually implementing anything) of the APIs and other resources such as the com.example.android.samplesync package, it seems that the pattern is flexible enough to adapt to your program needs.
The team I'm working with has implemented custom sync for our android app but I can tell you we didn't consider this option because we were committed to writing as much logic as possible to run with the WebView. I wouldn't necessarily recommend that, but that's beyond the scope here.

Android App with SQL server

I have a few questions regarding sql server in android.
Essentially, I am tring to create an app that communicates to a SQL server, runs queries, creates new tables, rows, etc. I have been doing a lot of research recently about getting a connection to a SQL server in android. I've seen the tutorial on using a php file and it seems that isn't quite what I am looking for.
My questions:
Is it possible to create an app like the one I described above?
Do I need to do it using a php file? (like the tutorials)
Is there another way to do what I am looking to do?
Should I create a webservice to do the database portion of it? If so, are there any tutorials out there about that?
I apologize for my noob-y questions. Thanks for your help
You should definitely create a webservice, because otherwise any malicious user who has access to your app (downloads it) could easily trash your DB. But allowing insertion and creation privileges to users seems like a bad idea already.
If your users need a personal db, why don't you use sqlite which is stored locally and has no access delays, and no internet connection requirements? Why do you want a single db that is completely exposed to everyone?
It is not a good idea to communicate directly to SQL server from Android Phones. You might hit so many technical constraints when you keep going with the development. I am not sure about he end result as well. It would be great to go ahead with the service that way you might have lot of controls inside the application and design it efficiently... Just a thoughts :)

Categories

Resources