A side question...
Lets say one of your tables in your database is "Customer".
Can Branch#1 change customer 'A' and Branch#2 change customer 'A'...
So at this point and time... Customer A has actaully 3 copies of it.
Server has the original Copy.
Branch#1 has a version of it with its changed data
Branch#2 has a version of it with its own changed data.
Branch#1 and Branch#2 may have ( but not necessarily ) have changed the same
field within the database.
How are you planning to update these records in this case?
That is why I suggested 1 DB that everyone hits through the net.
Unless you have already accounted for this?
Because I still see ( if you want to stick with multiple dbs' )... you
timestamp all the server records for your solution.
Any record changed after a timestamp the branch pulls...and any record
changed since the time stamp the branch pushes.
Now, here you will have to code as well that if you are pushing the data,
and the data has been already changed on the server by a different branch,
you will have to code around this.
Example...
Branch1 & 2 pull servers data Current date time= today at 9am lets say..
<time passes>
Now the time is today at 9:30 am.
Branch 1 changes customer 'A' and customer 'B'. Pushes data, pulls new data
( which is nothing new on the server).
Here, branch 1 must "Retain" that "Originally" it pulled at 9am. So first
branch 1 pushes all data it has in every table with a datestamp greater than
9 am (the last time it pulled) (these are all the changes in the tables).
Then To Pull, Branch 1 must pull every tables data that has changed since
9am.
So...at this piont...Branch 1 now is updated. and is in Sync with the server
db at 9:30 am.
<time passes>
Time is now 9:45
Branch 2 pushes data ( in this case customer A ), but it really cant /
shouldnt ? Because the customer A has been changed at 9:30 and Branch 2
knows that customer 'A' timestamp (on the server) should be '9AM' .
See the issue you are going to run into?
If this is not a problem...and you assume that the last person who pushes is
Always correct / most up to date, then this is fine,
Branch 2 pushes all data to the server that has changed since 9AM ( the last
time it pulled ).
Then Branch 2 must pull all data that has a greater timestam since 9AM on
the server.
In this case..Customer 'B' has a timestamp of 9:30 ( that is greater than
its original timestamp of 9AM) so it pulls Customer B.
Once this is done...Branch 2's new "timestamp" is now 9:45.
The next time this happens...the start time to pull data and compare data
starts at 9:45 am for branch 2.
Branch 1's time ...is anything since 9:30am.
But 1 db on the net with a DAL class to get and set data, gets rid of most
of these issues as everyone always has the latest version on the server and
is changing the latest data on the server.
Just a thought.
It can get ugly to keep multiple db's of the same db' in sync. I understand
it is necessary sometime... but the above mentioned...is the way I had to do
it in one of my dummy apps I created here in the office.
It was 'ok' in this app because for the most part, the data stayed stagnant
and only 1 person changed the data here and there within the week. The data
wasnt constantly changing.
I hope the above helps.
What did you have in mind happening - trying to solve this issue?
Miro