PostgreSQ 连接问题 FATAL: no pg_hba.conf entry for host
2017-08-11 18:50
1676 查看
PostgreSQ数据库为了安全,它不会监听除本地以外的所有连接请求,当用户通过JDBC访问是,会报一些如下的异常:
org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host
要解决这个问题,只需要在PostgreSQL数据库的安装目录下找到/data/pg_hba.conf,找到“# IPv4 local connections:”
在其下加上请求连接的机器IP
host all all 127.0.0.1/32 md5
32是子网掩码的网段;md5是密码验证方法,可以改(见文件pg_hba.conf上的说明)......
proxool建立数据库连接池代码
/*建立连接池*/
Properties info = new Properties();
info.setProperty(ProxoolConstants.USER_PROPERTY, this.username);
info.setProperty(ProxoolConstants.PASSWORD_PROPERTY, this.password);
info.setProperty(ProxoolConstants.PROTOTYPE_COUNT_PROPERTY, this.prototypeConnections);
info.setProperty(ProxoolConstants.MINIMUM_CONNECTION_COUNT_PROPERTY, this.poolMinConnections);
info.setProperty(ProxoolConstants.MAXIMUM_CONNECTION_COUNT_PROPERTY, this.poolMaxConnections);
info.setProperty(ProxoolConstants.HOUSE_KEEPING_SLEEP_TIME_PROPERTY, waitTime);
url = "proxool." + this.dbType + ":" + this.driver + ":"+this.dbURL;
ProxoolFacade.registerConnectionPool(url, info);
/*取连接,其中 this.dbType是连接池的关联名称*/
DriverManager.getConnection("proxool." + this.dbType);
org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host
要解决这个问题,只需要在PostgreSQL数据库的安装目录下找到/data/pg_hba.conf,找到“# IPv4 local connections:”
在其下加上请求连接的机器IP
host all all 127.0.0.1/32 md5
32是子网掩码的网段;md5是密码验证方法,可以改(见文件pg_hba.conf上的说明)......
proxool建立数据库连接池代码
/*建立连接池*/
Properties info = new Properties();
info.setProperty(ProxoolConstants.USER_PROPERTY, this.username);
info.setProperty(ProxoolConstants.PASSWORD_PROPERTY, this.password);
info.setProperty(ProxoolConstants.PROTOTYPE_COUNT_PROPERTY, this.prototypeConnections);
info.setProperty(ProxoolConstants.MINIMUM_CONNECTION_COUNT_PROPERTY, this.poolMinConnections);
info.setProperty(ProxoolConstants.MAXIMUM_CONNECTION_COUNT_PROPERTY, this.poolMaxConnections);
info.setProperty(ProxoolConstants.HOUSE_KEEPING_SLEEP_TIME_PROPERTY, waitTime);
url = "proxool." + this.dbType + ":" + this.driver + ":"+this.dbURL;
ProxoolFacade.registerConnectionPool(url, info);
/*取连接,其中 this.dbType是连接池的关联名称*/
DriverManager.getConnection("proxool." + this.dbType);
相关文章推荐
- PostgreSQ 连接问题 FATAL: no pg_hba.conf entry for host
- PostgreSQ 连接问题 FATAL: no pg_hba.conf entry for host
- PostgreSQ 连接问题 FATAL: no pg_hba.conf entry for host
- PostgreSQ 连接问题 FATAL: no pg_hba.conf entry for host
- PostgreSQ 连接问题 FATAL: no pg_hba.conf entry for host
- PostgreSQL 连接问题 FATAL: no pg_hba.conf entry for host
- FATAL: no pg_hba.conf entry for host "::1" odoo10连接postgre navicate连接问题
- Navicat Premium远程连接GP(Greenplum)集群 解决FATAL:no pg_hba.conf entry for host "172.20.20.2"问题
- PostgreSQL 连接问题 FATAL: no pg_hba.conf entry for host
- PostgreSQL 连接问题 FATAL: no pg_hba.conf entry for host
- no sys_hba.conf entry for host "192.168.16.28"
- Greenplum pg_hba.conf entry for host "192.168.2.111", user "gpadmin", database "template1", SSL off
- postgresql Connection to database failed: FATAL: no pg_hba.conf entry for host "10.129.195.161", us
- SQLSTATE[08006] [7] FATAL: no pg_hba.conf entry
- 程序链接PostgreSQL 时报错"no pg_hba.conf entry"
- jdbc mysql和sql server 建立连接代码 / tomcat+jdbc会出现的问题No suitable driver found for问题,
- 从pg_hba.conf文件谈谈postgresql的连接认证
- RCP Hibernate Derby数据库连接问题 No suitable driver found for
- ubuntu 系统解决mysql连接问题(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO))
- Linux下mysql用sqlyog连接报1042 can not get hostname for your address的问题