Is there any way to use duel database for a Java app? Default db will store in local PC, another one will remote online server, application should have an option "Sync to online" after got the command click all local data will Sync with online db.
Printable View
Is there any way to use duel database for a Java app? Default db will store in local PC, another one will remote online server, application should have an option "Sync to online" after got the command click all local data will Sync with online db.
Sure use something like a guid as the primary key in the table (to avoid conflicts when syncing).
There are many strategies for syncing the data. One is to always write to the local database and have a background thread which syncs the records. The thread can he started by a button click. You can track a synced record in the local db by adding a column like a datetime column - just insert the current date/time when the record was sucessfully synced. The background thread will sync records that don't have the sync datetime column set.