Article View: borland.public.interbase.replication
Article #124Primary Keys in replication problem
From: Guido Pietrella
Date: Mon, 29 Dec 2003 14:51
Date: Mon, 29 Dec 2003 14:51
42 lines
2744 bytes
2744 bytes
Hi everybody, I am currently evaluating IBReplicator to see if it can solve my problem... I wrote some years ago an application which uses Interbase as the main database. Of course I didn't have replication in mind at the time. The database is shared between 10-15 users over a LAN in one office. Now they want to expand to a remote office in which there'll be initially 2-3 users, but they could be more in the future. Now, every table in the DB has its own numeric ID field mantained by generators. In some tables the generator is incremented by a trigger (i.e. before insert), but in other cases generator is incremented by the application, because it needs to know the ID before the row is actually written. Since generators' values are not replicated, I have to modify the way the application handles records IDs. I thought I could build a IDs table and stop using generators. This table would have only two cols: TableName(PK) and ID value. The ID value for each table could be incremented inside a trigger or in the application just exactly a generator and the table could be replicated by IBReplicator. The problem arises when the connection between the 2 databases is down for a while. In this situation, any of the two DBs could individually increment the value of the ID and when the connection is back there can be a data loss. Looks like the only solution is to use non-numeric random generated unique IDs as primary keys!! ARGH!! This would mean a complete redesign of database and a LONG series of modifications inside the application! I'm considering the possibility to kill myself... :)) Has anybody ever happened to have this problem? I'd like to continue using simple numeric IDs. Is there a way to achieve this? Otherwise, is there any solution that doesn't terribly affect the app and DB design. Please help me. Thanks in advance, Guido Pietrella.
Technical Details
Message-ID:
<2f7a219e.0312290651.7001df10@posting.google.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f89d7,64bf75c6bd663b3f,start X-Google-Attributes: gidf89d7,public X-Google-ArrivalTime: 2003-12-29 06:51:43 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail From: 2102b044@katamail.com (Guido Pietrella) Newsgroups: borland.public.interbase.replication Subject: Primary Keys in replication problem Date: 29 Dec 2003 06:51:42 -0800 Organization: http://groups.google.com Lines: 42 Message-ID: <2f7a219e.0312290651.7001df10@posting.google.com> NNTP-Posting-Host: 81.211.189.180 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1072709503 29754 127.0.0.1 (29 Dec 2003 14:51:43 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 29 Dec 2003 14:51:43 +0000 (UTC)