Syncing SQLite with SQLServer using Sync Framework
Asked Answered
U

2

6

I'm trying to make an online application which can sync the SQLite database running on an Android device with the SQL running on the server. We have an enterprise app running on .NET and Android; we need to sync their data to retain consistency. It will be a bi-directional sync: any data changes which occur (either on the client or on the database server) should be synced.

I saw that this can be achieved with many approaches but for this scenario I'm advised to use the Microsoft Sync Framework since it automates the sync process and can be handy as well. I did some research on using the Sync framework and found some samples on the Microsoft site. But mostly they are doing offline synchronization: they are basically doing the sync process on the desktop where source and target databases are on the same machine. But for my scenario, this is not the case. I have SQLite on the client machine and SQL on the server so here an online sync process seems to be required.

How should I achieve this?

Ungrounded answered 6/8, 2012 at 6:22 Comment(2)
A totally generic sync is very hard, if not impossible, to do between two so different databases. I also assume there have to be some kind of business rules involved in the sync, if someone removes the contents of the database on the device, the master should not be erased I presume? As I see it, you need to give more details and limit your question a bit to get even a remotely useful answer.Hyperesthesia
thanks for ur reply Joachim - actually we are just focusing on the Add operation as for now. Lets say for instance i added a record on my local SQLite through the android phone, now when i press the sync button this newly created record should sync with the remote SQL running on the server.Ungrounded
L
1

they are sample apps, so for simplicity, they just point both source and target databases locally. there's no stopping you from repointing database connections to a remote server.

instead of looking at Sync Framework SDK alone, look at the Sync Framework Toolkit instead. That's the one that addresses non-MS client platforms.

Linwoodlinz answered 31/8, 2012 at 1:55 Comment(2)
Thanks for your reply. Yep JuneT there is no stopping me doing that but I'm really confused how to go about it as there is no SQLite provider available.Ungrounded
the toolkit has a sample for SQL Ce which you can use as a reference for creating your on SQLLite providerLinwoodlinz
D
1

The Microsoft Sync Services work with any data source that can be connected by the ADO.NET data provider. You will want to look at how to do a peer-to-peer synchronization. The rules for Microsoft Sync Framework are kept in a SQL Server Compact Edition database, and needs to reside on the SQL Server side, and most likely you will perform the synchronization over a network connection (Internet) so you will need to set up a web server and web services to activate the sync agent from the Android side. Making the agent and the sync adapters will be quite a bit of work. Lucky for you enterprising developers have already done this work: https://ampliapps.com/sqlite-sync/ There are other tools like the one I posted, and for transparency sake I have no interests in Ampliapps, I just know of their product.

Disembark answered 12/12, 2018 at 14:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.