Home > Database > Mysql Tutorial > debian上安装postgresql的dblink

debian上安装postgresql的dblink

WBOY
Release: 2016-06-07 14:53:44
Original
1220 people have browsed it

debian上安装postgresql的dblink postgresql9.1从debian官网上下载安装的包里面没有dblink,以安装postgresql9.0为主。 安装dblink前首先检 查系统是否装载软件postgresql-contrib-9.0,如果没有装此软件到debian的官方网站上下载安装安装命令: ~# apt-get i


debian上安装postgresql的dblink

 

postgresql9.1从debian官网上下载安装的包里面没有dblink,以安装postgresql9.0为主。 

安装dblink前首先检 查系统是否装载软件postgresql-contrib-9.0,如果没有装此软件到debian的官方网站上下载安装安装命令: 

~# apt-get install postgresql-contrib-9.0 

 

安装软件后,查询dblink.sql的路径。命令: 

~# dpkg -S dblink.sql 

查询后结果: 

postgresql-contrib-9.0: /usr/share/postgresql/9.0/contrib/dblink.sql 

接着切换用户。命令 

~# su - postgres 

  www.2cto.com  

接口执行安装dblink。命令 

~# psql -p 5432 -h 192.168.1.x dbname

安装成功后进入数据库 

~# psql -p 5432 -h 192.168.1.x -U dbname 

然后建立dblink 

select dblink_connect('host=192.168.1.y port=5432 user=xxx dbname=xxx password=xxx'); 

 

如果建立连接的时候提示让你检查权限,你要去文件中把你的配置trust改成md5。 

访问数据库表 

select id from dblink('select a from t1 where a=''a'' ') as t1(id vachar(100)); 

关闭dblink 

select dblink_disconnect(); 

 

第一次查询的时候可能要建立管道查询数据会比较慢,但是第二次以后就会很快了。 
 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template