RE: Link to a table on another DB
Posted in 2003
Topics: General Discussion
Ferro wrote
> Sent: 19 May 2003 11:36
> To: informix-list@iiug.org
> Subject: Link to a table on another DB
>
>
> On my ids I have 2 db: NEW and OLD.
> The 2 db have the same tables.
> The data in VARY table are different from NEW
> and OLD db, but the data in SAME table are
> the same in 2 db.
> So I ask me: why have I to duplicate the data in
> table SAME?
> Is there a way to create, on NEW db, a link from
> NEW.SAME table to OLD.SAME table?
>
> In other way, on my program I need to refer
> on NEW db, but the data should reside on
> OLD db.
>
Synonyms are what you need.
Instead of create table command in database2 d0 -
create synonym table1 for database1@on_server1_tcp:table1;
Colin Bull wrote:
> Ferro wrote
>>On my ids I have 2 db: NEW and OLD.
>>The 2 db have the same tables.
>>The data in VARY table are different from NEW
>>and OLD db, but the data in SAME table are
>>the same in 2 db.
>>So I ask me: why have I to duplicate the data in
>>table SAME?
>>Is there a way to create, on NEW db, a link from
>>NEW.SAME table to OLD.SAME table?
>>
>>In other way, on my program I need to refer
>>on NEW db, but the data should reside on
>>OLD db.
>>
>
> Synonyms are what you need.
>
> Instead of create table command in database2 d0 -
> create synonym table1 for database1@on_server1_tcp:table1;
The only thing to watch is SE - no synonyms there. You can achieve
more or less the same effect with links (symbolic or hard), but you
have to be extremely careful. Doing so won't be supported. That
doesn't stop it working, of course. But backups, recovery, etc need
to be thought about.
--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/