Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Communication Between 2 Databases

I have 2 databases and want to implement triggers on table update of database1 to do do some updates on database2's tables.

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?


2 Answers

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

like image 87
Andrea Girardi Avatar answered Jan 03 '26 23:01

Andrea Girardi


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

like image 29
Milen A. Radev Avatar answered Jan 04 '26 00:01

Milen A. Radev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!