PostgreSQ 连接问题 FATAL: no pg_hba.conf entry for host

简介: PostgreSQ数据库为了安全,它不会监听除本地以外的所有连接请求,当用户通过JDBC访问是,会报一些如下的异常: org.postgresql.util.PSQLException: FATAL: no pg_hba.

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);

目录
相关文章
|
8月前
|
SQL 运维 关系型数据库
will be dropped if server is in r-o mode问题解决
【6月更文挑战第26天】will be dropped if server is in r-o mode问题解决
192 2
|
9月前
|
数据库
Greenplum【部署 09】has an active database process on port = 6000 和 [Errno 2] No such file or directory
Greenplum【部署 09】has an active database process on port = 6000 和 [Errno 2] No such file or directory
135 0
|
8月前
|
关系型数据库 MySQL 数据库连接
mysql报错:Host‘IP地址‘ isblocked because of many connection errors;unblock with ‘mysqladmin flush-hosts‘
mysql报错:Host‘IP地址‘ isblocked because of many connection errors;unblock with ‘mysqladmin flush-hosts‘
369 1
|
关系型数据库 MySQL
mysql远程连接 Host * is not allowed to connect to this MySQL server
mysql远程连接 Host * is not allowed to connect to this MySQL server
80 0
|
关系型数据库 MySQL
The server quit without updating PID file (/usr/local/mysql/data/localhost.localdomain.pid).
The server quit without updating PID file (/usr/local/mysql/data/localhost.localdomain.pid).
224 0
|
分布式计算 Hadoop Java
hbase_异常_05_End of File Exception between local host is: "rayner/127.0.1.1"; destination host is: "localhost":9000;
一、异常信息 java.io.EOFException: End of File Exception between local host is: "ubuntu/127.0.1.1"; destination host is: "localhost":9000; : java.
4515 0
|
网络协议 关系型数据库 网络安全
pg_hba.conf 和 pg_ident.conf
初始化后pg_hba.conf默认的内容: # TYPE  DATABASE        USER            ADDRESS                 METHOD # "local" is for Unix domain socket connectio...
1186 0
|
关系型数据库 MySQL
Mysql远程连接 Host * is not allowed to connect to this MySQL server
Mysql远程连接 Host * is not allowed to connect to this MySQL server 解决办法:在本机登入mysql后,选择用户,修改你远程链接的用户的主机,从 localhost 改为 %  博客内容仅代表个人观点,如发现阐述有误,麻烦指正,谢谢!
1373 0
|
关系型数据库 MySQL
mysql配置完半同步复制之后报错[ERROR] The server quit without updating PID file
修改配置,MySQL启动报:[ERROR] The server quit without updating PID file     [root@localhost mysql]# /etc/init.
2043 0