Daily Snippet, Developer to developer

PostgreSQL 9.3 : Create dblink

After read this post from Mr. , I wanna add some detail only on creating dblink :

  1. First change your pg_hba.conf : host all all 127.0.0.1/32 trust
  2. Create dblink : SELECT dblink_connect(‘<dblink-name>’,’dbname=<postgres-dbname> port=<postgres-port> user=<postgres-username> password=<postgres-password>’);//it should return OK 
  3. Test it :
    SELECT *
    FROM dblink(‘<dblink-name>’,’select id,name from emp’)
    AS zone( id int,name varchar);
Standard

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s