pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alain.Tesio@sip.fr
To: Nicolas Huillard <nhuillard@ghs.fr>
To: pgsql-interfaces@postgreSQL.org
Subject: Re: [INTERFACES] Replication between MS Access and PostgreSQL
Date: Thu, 28 Oct 1999 09:46:26 +0200
Message-ID: <C1256818.002AA5F1.00@applications.sip.fr> (raw)



--- Nicolas Huillard <nhuillard@ghs.fr> wrote:
> This description is a way to export tables from Access to Postgres.
> I know how to do this.
> What I'm looking for is a tool to synchronize the data between the
> same table inside Access and Postgres, ie : a new record in
> Postgres should be transfered to Access, and the same the other
> way.
>
> Thanks.

If you only need to transfer new rows and don't care about
updated or deleted rows, it's pretty easy to do, especially if you
have an identifier in your table generated by a sequence
(or the date it was inserted).

in Postgres :

table DATA (rowid, other_columns), index on rowid
table LAST_CHECK (rowid) -- one row in this table

select @rowid1=rowid from LAST_CHECK
select @rowid2=max(rowid) from DATA
select * from DATA where @rowid1 < rowid <= @rowid2
update from LAST_CHECK set rowid=@rowid2

(Sybase-like syntax for variables, sorry ...)

And something similar in Access.
You must have a cron job which runs this script periodically
and insert the resultset from the third instruction into Access.
It doesn't need to be transactional.
The both databases should generate identifiers on non-overlapping
ranges, for example negative in Access, replace max by min for the
other script and reverse the comparison order.

Alain







view thread (9+ messages)  latest in thread

Message-ID: <C1256818.002AA5F1.00@applications.sip.fr>
Permalink:  ../C1256818.002AA5F1.00@applications.sip.fr/
Also on:    postgresql.org/message-id/C1256818.002AA5F1.00@applications.sip.fr

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: Alain.Tesio@sip.fr, nhuillard@ghs.fr
  Subject: Re: [INTERFACES] Replication between MS Access and PostgreSQL
  In-Reply-To: <C1256818.002AA5F1.00@applications.sip.fr>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox