7

Are there any open source applications that demonstrate good techniques of online-offline synchronization of databases, something like Remember The Milk does with their iPhone app, Google Gears offline mode, etc.?

Community
  • 1
  • 1
Swaroop C H
  • 16,902
  • 10
  • 43
  • 50
  • I did think of IMAP clients, but IMAP does not have full functionality when offline, for example, messages are kept in outbox and then later shifted to sent mail, so it has temporary arrangements... this is the best I can explain in a short sentence on why IMAP isn't a good example. – Swaroop C H Mar 22 '09 at 03:49
  • @Marc Preferably Python. – Swaroop C H Apr 09 '09 at 06:56

5 Answers5

8

The Unison file synchronizer is a magnificent tool, but its source code is not for the faint of heart. You didn't ask for academic papers but I have written one I'm proud of. There was some perl code to go with that one but I'm not sure if it's of any use. If you want it send me an email.

Norman Ramsey
  • 198,648
  • 61
  • 360
  • 533
  • Thanks Norman, the paper should be helpful, will take a look. However, can the concepts in the paper be used to work for database synchronization (naive question?), sorry if I wasn't clear before that I'm specifically looking at synchronization of structured data. – Swaroop C H Mar 22 '09 at 04:37
  • Certainly the ideas of logging operations and putting the log into a normal form will be useful for databases. I expect the details of the algebra to be different. Also check out Pierce's new work on "lens programming", which is motivated by the database view update problem. – Norman Ramsey Mar 22 '09 at 18:31
3

google gears itself is open source. you'll want to look at the localserver module.

check out code.google.com/p/gears for the main developer site, and the LocalServer source. Although gears is a complex piece of software because it has lots of components (browser plugin interface, integration with javascript, SQLite integration, etc...), it is fairly well factored, so the LocalServer source is pretty easy to follow.

Aaron
  • 829
  • 6
  • 12
  • As per my understanding, Gears provides an offline database and a API to detect online/offline connectivity, it does NOT do any kind of synchronization itself. Application programmers have to do that themselves. – Swaroop C H Mar 21 '09 at 03:04
2

I have experience with SymmetricDS and it is really good. It can handle a lot of scenarios. It is open source, so it can be modified or extended for some special cases. As the authors say it was developed for a real life project so you can be sure that it really works fine (and it works for me also).

Just one thing. SymmetricDS relies on database triggers, so your database must support triggers.

Bojan Milenkoski
  • 501
  • 5
  • 13
2

The Wikipedia article on Operational Transform references four open-source applications - Ace, Gobby, Subetheredit and So6. Perhaps one of them is able to used as a starting point for you.

While they might not work directly with your DBMS of choice, it would be worth considering Operation Transform as the basis of your synchronisation.

Daniel Paull
  • 6,797
  • 3
  • 32
  • 41
  • Thank you for this information. I didn't know that there was a whole field dedicated to this! I found this interesting also in the context of the [Google Waves "Under The Hood" talk](http://www.youtube.com/watch?v=uOFzWZrsPV0) where they talk about Operational Transform for the first 20 mins. – Swaroop C H Jun 06 '09 at 13:49
  • I had been meaning to come back here and mention Google Wave - but you're one step ahead! – Daniel Paull Jun 07 '09 at 10:46
0

The article Create offline web applications on mobile and stationary devices with CouchDB describes a simple inventory management app. with source code. It uses CouchDB's replication support. CouchDB is a NoSQL database though (document oriented, to be more specific). If you are looking for a solution for RDBMS, the database synchronization provider in Microsoft's Sync framework takes advantage of the change tracking mechanism built in SQL server 2008. Microsoft also describes a service-oriented approach in their documentation of the Smart Client Offline Application Block. This approach is more flexible in some cases than using merge-replication in the data-oriented approach.

CruiZen
  • 182
  • 2
  • 6