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

目录
相关文章
|
4月前
|
数据库
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
48 0
|
8月前
|
关系型数据库 MySQL 数据库
成功解决错误1130- Host xxx is not allowed to connect to this MySQL server
成功解决错误1130- Host xxx is not allowed to connect to this MySQL server
|
网络安全
错误集--NFS报错clnt_create: RPC: Port mapper failure - Unable to receive: errno 113 (No route to host)
错误集--NFS报错clnt_create: RPC: Port mapper failure - Unable to receive: errno 113 (No route to host)
1145 0
错误集--NFS报错clnt_create: RPC: Port mapper failure - Unable to receive: errno 113 (No route to host)
|
关系型数据库 MySQL Docker
解决Host ‘xxx.xx.xx.xx‘ is not allowed to connect to this MySQL server
解决Host ‘xxx.xx.xx.xx‘ is not allowed to connect to this MySQL server
124 0
解决Host ‘xxx.xx.xx.xx‘ is not allowed to connect to this MySQL server
|
分布式计算 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.
4420 0
|
关系型数据库 MySQL C#
Unable to connect to any of the specified MySQL hosts.
c#连接Mysql数据建立连接时提示:Unable to connect to any of the specified MySQL hosts. 出现此错误的原因是Server(数据库服务器IP地址填写错误) 当Server配置值是“(local)”或者是"(localhost)"时都会产生...
2947 0
|
网络协议 关系型数据库 网络安全
pg_hba.conf 和 pg_ident.conf
初始化后pg_hba.conf默认的内容: # TYPE  DATABASE        USER            ADDRESS                 METHOD # "local" is for Unix domain socket connectio...
1125 0
|
关系型数据库
PG config9.4
FILE LOCATIONS data_directory ='/pghs/pg${port}/data'hba_file ='/pghs/pg${port}/data/pg_hba.
857 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.
1982 0
|
Linux 网络架构
Root-NFS: Unable to get mountd port number from server, using default
问题描述:         以前下载到开发板linux内核启动好好地,今天突然启动不了了,到达Root-NFS: Unable to get mountd port number from server, using default这个位置就停住了,过了一段时间就显示,如图:       很明显,我的nfs有问题。
1400 0