views:

575

answers:

3

Hello.

I'm hoping to find out what tools folks use to synchronize data between databases. I'm looking for a JDBC solution that can be used as a command-line tool.

There used to be a tool called Sync4J that used the SyncML framework but this seems to have fallen by the wayside.

+1  A: 

I have heard that the Data Replication Service provided by Db4O is really good. It allows you to use Hibernate to back onto a RDBMS - I don't think it supports JDBC tho (http://www.db4o.com/about/productinformation/drs/Default.aspx?AspxAutoDetectCookieSupport=1)

There is an open source project called Daffodil, but I haven't investigated it at all. (https://daffodilreplicator.dev.java.net/)

The one I am currently considering using is called SymmetricDS (http://symmetricds.sourceforge.net/)

There are others, they each do it slightly differently. Some use triggers, some poll, some use intercepting JDBC drivers. You need to decide what technical limitations you are under to determine which one you really want to use.

Wikipedia provides a nice overview of different techniques (http://en.wikipedia.org/wiki/Multi-master_replication) and also provides a link to another alternative DBReplicator (http://dbreplicator.org/).

Aidos
A: 

If you have a model and DAO layer that exists already for your codebase, you can just create your own sync framework, it isn't hard.

Copy data is as simple as:

  1. read an object from database A
  2. remove database metadata (uuid, etc)
  3. insert into database B

Syncing has some level of knowledge about what has been synced already. You can either do it at runtime by getting a list of uuids from TableInA and TableInB and working out which entries are new, or you can have a table of items that need to be synced (populate with a trigger upon insert/update in TableInA), and run from that. Your tool can be a TimerTask so databases are kept synced at the time granularity that you desire.

However there is probably some tool out there that does it all without any of this implementation faff, and each implementation would be different based on business needs anyway. In addition at the database level there will be replication tools.

JeeBee
Thanks for the thoughtful answer. I have a roll-your-own syncing strategy at the moment and I'm looking to replace it with something more generic.
Nick Pierpoint
+1  A: 

True synchronization requires some data that I hope your database schema has (you can read the SyncML doc to see how they proceed). Sync4J won't help you much, it's really high-level and XML oriented. If you don't foresee any conflicts (which means: really easy synchronisation), you could try with a lightweight ETL like Enhydra Octopus.

Damien B