开发者

Communication Between 2 Databases

开发者 https://www.devze.com 2023-04-11 07:44 出处:网络
I have 2 databases and want to implement triggers on table update of database1 to do do some updates on database2\'s tables.开发者_如何学Go

I have 2 databases and want to implement triggers on table update of database1 to do do some updates on database2's tables.开发者_如何学Go

Example:

db1 has a table 1t1

db2 has a table 2t1

on inserting a touple into 1t1 i want to insert corresponding touple into 2t1

As of now Im using postgresql, but I dont mind switching to other free databases.

How to achieve this?


I suggest to use database link to establish a connection between two remote DB.

Take a look to this page:

http://www.postgresql.org/docs/current/static/contrib-dblink-connect.html

There is also a good tutorial here:

http://www.postgresonline.com/journal/archives/44-Using-DbLink-to-access-other-PostgreSQL-Databases-and-Servers.html

bye, Andrea


If you could replace databases with schemas everything becomes easy. Possibility of such replacement depends on why you have chosen databases as organisational units.


Postgresql 9.1 has a new feature called "foreign table":

http://www.postgresql.org/docs/9.1/static/sql-createforeigntable.html

Does that help maybe?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号