PostgreSQ 连接问题 FATAL: no pg_hba.conf entry for host
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);
PostgreSQ 连接问题 FATAL: no pg_hba.conf entry for host的更多相关文章
- PostgreSQL 连接问题 FATAL: no pg_hba.conf entry for host
The server doesn't grant access to the database: the server reports FATAL: no pg_hba.conf entry for ...
- PSQLException: FATAL: no pg_hba.conf entry for host "127.0.0.1", user "ambari", database "ambari", SSL off
On your Postgres server, you will need to update your pg_hba.conf file to allow access for the ambar ...
- Azure安装完postgresql遇到:psql: error: could not connect to server: FATAL: no pg_hba.conf entry for host
进入创建好的Azure Database for PostgreSQL server 点击connection security 在Firewall rules中 Add 0.0.0.0-255.2 ...
- navicat 连接postgresql报错pg_hba.conf
PostgreSQ数据库为了安全,它不会监听除本地以外的所有连接请求,当用户通过JDBC访问是,会报一些如下的异常: org.postgresql.util.PSQLException: FATAL: ...
- 从pg_hba.conf文件谈谈postgresql的连接认证
最近一直在弄postgresql的东西,搭建postgresql数据库集群环境什么的.操作数据库少不得要从远程主机访问数据库环境,例如数据库管理员的远程管理数据库,远程的客户存取数据库文件. 而在po ...
- PostgreSQL远程连接,发生致命错误:没有用于主机“…”,用户“…”,数据库“…”,SSL关闭的pg_hba.conf记录
PostgreSQL远程连接方法 有时候在远程连接时,会报Error connecting to the server:致命错误:没有用于主机“…”,用户“…”,数据库“…”,SSL关闭的pg_hba ...
- postgreSQL远程连接出现:Error connecting to server :致命错误 SSL关闭的pg_hba.conf记录
异常截图:
- [zz]pg_hba.conf 一种安全地配置策略
PostgreSQL默认只监听本地端口,用netstat -tuln只会看到“tcp 127.0.0.1:5432 LISTEN”.修改postgresql.conf中的listen_address= ...
- pg_hba.conf、pool_hba.conf 以及 pool_passwd 三者间的关系
pg_hba.conf.pool_hba.conf 以及 pool_passwd 三者间的关系: 1.pg_hba.conf.pool_hba.conf 以及 pool_passwd 三者关系 pg_ ...
随机推荐
- GRYZY #13. 拼不出的数
拼不出的数 lost.in/.out/.cpp [问题描述] 3 个元素的集合 {5, 1, 2} 的所有子集的和分别是 0, 1, 2, 3, 5, 6, 7, 8.发 现最小的不能由该集合子集拼出 ...
- Spring 详解(三)------- SpringMVC拦截器使用
目录 不拦截静态资源 使用拦截器 拦截器使用测试 SimpleMappingExceptionResolver 拦截异常 不拦截静态资源 如果配置拦截类似于*.do格式的拦截规则,则对静态资源的访问是 ...
- Ubuntu 16.04通过Snap安装应用程序
16.04LTS可以说是一个不寻常的5年支持版本,同时也带来了Snap应用,并通过Snap可以安装众多的软件包.需要注意的是,Snap是一个全新的软件包架构,但是同样也比其它的软件包大很多. 简单的安 ...
- configure: error: Cannot find php_pdo_driver.h.
安装pdo_mysql cd /usr/local/src/php-5.4.0/ext/pdo_mysql/ /usr/local/php/bin/phpize # /usr/local/php为 ...
- http://www.yiibai.com/java8/java8_temporaladjusters.html
原文:http://www.yiibai.com/java8/java8_temporaladjusters.html TemporalAdjuster 是做日期数学计算.例如,要获得“本月第二个星期 ...
- Mysql 性能优化20个原则(2)
5. 在Join表的时候使用相当类型的例,并将其索引 如果你的应用程序有很多 JOIN 查询,你应该确认两个表中Join的字段是被建过索引的.这样,MySQL内部会启动为你优化Join的SQL语句的机 ...
- python的分布式队列神器 Celery
pip search kafka可以搜索到很多kafka的python插件,选择一个大家用的比较多的 celery结合kafka使用 使用kafka扩展python logging集中式日志收集 re ...
- PostgreSQL触发器的使用
原文: https://www.yiibai.com/postgresql/postgresql-trigger.html -------------------------------------- ...
- docker nginx镜像+phpfpm 镜像 组合配置 搭建 PHP+nginx 环境
前言 在以往的容器环境部署中 运行环境 我们通常把 类似 apache nginx php 等 打包在一个镜像中 起一个容器. 这样做的好处是 方便 简单. 不便的地方是 如果PHP 需要扩展新的 相 ...
- angularjs中下拉框select option默认值
1.问题说明: option ng-repeat多空白项 2.解决方案: html: <ion-view hide-nav-bar="true"> <ion-co ...