我的情况如下: 有两台机器,操作系统linux下,postgresql版办是6.4的,设置了postgresql.conf 中的tcpip_socket= true 和pg_hba.conf,使得两台机器在shell提示符下用:$psql -h ip -d dbname可以相互访问。 可是不知道在C++用libpq库怎么访问远程的postgresql数据库。 postgresql 提供了两个接口函数设置环境变量,对于第二个接口函数我不太明白,两个接口函数如下: PgEnv(); PgEnv(const string& auth, const string& h...
by cizi - C/C++ - 2004-09-08 22:11:10 阅读(1718) 回复(2)
众所周知,Postgres 8.1 分别发行了 Linux和Windows 两个版本,
所以,介绍远程连接的主题时,也是分别介绍这两个系统上是如何实现的。
其实,windows版比linux版的步骤少一些。
一、实现远程连接Linux上的postgresql服务器。
主要分两个步骤:
<1>要使Linux上的postgresql打开 “unix的tcpip套接子”。
编辑 $POSTGRES/data/postgresql.conf 文件,
将tcpip_socket=off改成tcpip_socket=on即...
PGconn *PQconnectdb(const char *conninfo) db_local = PQconnectdb("dbname = dbname1"); db_remote = PQconnectdb("hostaddr = 'hostip', dbname = 'dbname2'); 这样连接可以吗?
日志: 无法联接到地址为 "::1", 端口为 113 的 Ident 服务器: 拒绝连接 致命错误: 用户 "postgres" Ident 认证失败 pg_hba.log
现在有个程序数据库用的是oracle,现在需要移植到postgresql中。因此在源码和配置文件中做了些修改,但是在登录时就提示如下的错误,不知道哪里的原因? HTTP Status 500 - IO Error: The Network Adapter could not establish the connection -------------------------------------------------------------------------------- type Exception report message IO Error: The Network Adapter could not establish the con...
使用PQconnectdb时出现错误如下: could not get socket error status: Invalid argument 想问下这是由于什么引起的,万分感谢
C:\Windows\system32>psql psql: could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "???" and accepting TCP/IP connections on port 5432? 错误就是这样的。有谁能解答啊?谢谢。。。万分感谢。。。。
在服务端按要求做好了server.key server.crt ; 在postgresql.conf中打开了SSL 选项; 在pg_hba.conf中设置了SSL登陆的账号:hostssl all all 192.168.0.2/32 md5; 用postgresql的命令行登陆显示是加密的了; 用psycopg2去连接数据库 conn = psycopg2.connect(database="testDB", user="testssl", host="192.168.0.1",port="5432",password="123456",sslmode="require") 是不是就可以使用SSL加密了?? 请高手帮我看看我的理解是...
数据库需要脱机,但是pg好像不支持。 在网上找了半天,没找到相关的贴子。官方好像说可以用第三方工具关掉tcp连接。然后补了一句,重启是最简单的办法。顿时晕。 如果数据库要是有很多并发链接,刚刚重启完,又脱不了机了。 这是哪门子事情啊,商业方面也太差了点。 刚刚接触pg不久,哪位能告知是否还有其它的办法?
在window2000操作系统下,在.java中写入: Class.forName("org.postgresql.Driver"); conn = DriverManager.getConnection("jdbc:postgresql://192.168.0.8/user", "haoyuan", "haoyuan"); 运行结果出现下面错误: Something unusual has occured to cause the driver to fail. Please report this exception: java.sql.SQLException: FATAL 1: No pg_hba.conf entry for host 192.168.0.8, user haoyuan, database user 请问:哪...