Subject Re: Replicating user data
Author Adam
--- In firebird-support@yahoogroups.com, Grant Brown <grant@s...>
wrote:
> Hi all,
>
> Using Delphi 5, FIBPlus and FireBird 1.5
>
> Never had anything to do with replication before so please bear
with me.
>
> I need to be able to allow user of our product the ability to
>
> 1) - Disconnect from the server DB (FB 1.5 in Superserver mode)
> 2) - Take there laptop out into the field and edit documents and or
> create new ones
> 3) - Connect back into the server and upload new or changed
documents.
>
> So in order to do that I assume that they will need a copy of the
DB on
> there laptop as the embedded version and also access to the server
DB
> (please note that we have the server DB up and running)

> So first question - How does one swap between embedded version and
> server version at runtime
>

Read section 2.2 under the Readme_embedded.txt.

In a nutshell, you only need to use the embedded dll. If you connect
to a TCP string eg

server:MyDB

It will be just like a non embedded dll, however if you connect to
c:\path\to\db then it uses the embedded engine.
> Next question - the big one, how does one implement replication.

Carefully.

On a simple level, if you have a rule that all PK's are > 0 you could
use negative numbers as primary keys when the ID is generated in "
"briefcase mode", then during the synchronisation, cycle through each
table's negative PK's and query them a "real" PK from the global
database. If you use foreign key "on update cascade" rules this will
be relatively simple. This data can then be pumped into the real
database.

As the other reply stated, now might be an ideal time to consider a
data abstraction layer such as RO or kbm, both of which I have used
(and still use with success).

Other things to consider though is what it actually means to be in
briefcase mode. For example, you probably don't need every document
available to a user in briefcase mode (or it will take too long to
synchronise).

Adam