database server? - android sqlite bidirectional synchronization sqlite





how or (3)


Can you use Oracle Database as your server-side DB?

If so, you should consider Oracle Database Lite, which includes a full synchronization solution that is compatible with SQLite and Android, and was designed for multi-user environments.

It supports automatic synchronization, advanced conflict resolution, and multiple sync models. It also supports deploying and managing apps from a central management console, and even device management.

You can read more about it here: http://www.oracle.com/technetwork/database/database-lite/overview/index.html

Also, you can click on the download tab to try it out for yourself.

Eric

I need to sync my Android SQLite DB with my cloud-server DB, and doing it in a bi-directional way in a multiuser environment.

I have found and introduction to the solution here but I would like to read about a better solution/algorithm.




I'd recommend to send db file to your server and do merging on the server side. Then send merged db back to the client if needed. Your solution will vary based on conflict resolve algorithm and your database schema. But here is example for the simplest case:

sqlite> attach 'client.db3' as ClientDBtoMerge;           
sqlite> insert into TableName select * from ClientDBtoMerge.TableName;
sqlite> detach database ClientDBtoMerge; 

Hope you are be able to modify example for bi-directional merge.




On bulk inserts

Inspired by this post and by the question that led me here -- Is it possible to insert multiple rows at a time in an SQLite database? -- I've posted my first Git repository:

https://github.com/rdpoor/CreateOrUpdate

which bulk loads an array of ActiveRecords into MySQL, SQLite or PostgreSQL databases. It includes an option to ignore existing records, overwrite them or raise an error. My rudimentary benchmarks show a 10x speed improvement compared to sequential writes -- YMMV.

I'm using it in production code where I frequently need to import large datasets, and I'm pretty happy with it.





android database sqlite data-synchronization