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的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 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 ...

  4. navicat 连接postgresql报错pg_hba.conf

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

  5. 从pg_hba.conf文件谈谈postgresql的连接认证

    最近一直在弄postgresql的东西,搭建postgresql数据库集群环境什么的.操作数据库少不得要从远程主机访问数据库环境,例如数据库管理员的远程管理数据库,远程的客户存取数据库文件. 而在po ...

  6. PostgreSQL远程连接,发生致命错误:没有用于主机“…”,用户“…”,数据库“…”,SSL关闭的pg_hba.conf记录

    PostgreSQL远程连接方法 有时候在远程连接时,会报Error connecting to the server:致命错误:没有用于主机“…”,用户“…”,数据库“…”,SSL关闭的pg_hba ...

  7. postgreSQL远程连接出现:Error connecting to server :致命错误 SSL关闭的pg_hba.conf记录

    异常截图:

  8. [zz]pg_hba.conf 一种安全地配置策略

    PostgreSQL默认只监听本地端口,用netstat -tuln只会看到“tcp 127.0.0.1:5432 LISTEN”.修改postgresql.conf中的listen_address= ...

  9. 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_ ...

随机推荐

  1. python入门示例程序

    该实例是raspi和dsp电机运动控制板的串口uart通信: import serial class SerialHandler(): ''' raspi serial for communicati ...

  2. Codeforces Gym 100286I iSharp 模拟

    原题地址:http://codeforces.com/gym/100286/attachments/download/2013/20082009-acmicpc-northeastern-europe ...

  3. 临远的spring security教程

    为啥选择Spring Security 欢迎阅读咱们写的Spring Security教程,咱们既不想写一个简单的入门教程,也不想翻译已有的国外教程.咱们这个教程就是建立在咱们自己做的OA的基础上,一 ...

  4. 上传jar包至maven私服

    1.maven环境变量配置(新建系统变量,编辑Path) 2.修改maven的setting文件 2.1 私服的用户配置 2.2 私服镜像配置 2.3 (我也不知道是啥) <profile> ...

  5. 转:NetBeans的远程Linux C开发实践

    转: http://blog.csdn.net/jacktan/article/details/9268535 一直以来总觉得NetBeans生活在Eclipse的阴影下,同样做为一款不错的基于Jav ...

  6. 高仿微信实现左滑显示删除button功能

    在实际项目中删除列表中的某一项是很常见的功能.传统的做法能够使用长按监听器等,而如今流行的做法是左滑弹出删除button,微信,QQ等都是这么做的,以下做一个演示样例,代码例如以下: 主页面MainA ...

  7. 网页JS简繁体字转换

    用法:非得加上html头 utf-8编码 其它编码无测试 head 中引用 <script language='javascript' src='zh.js'></script> ...

  8. IE浏览器部分版本不支持background-size属性问题

    background-size是CSS3新增的属性,但是IE8以下还是不支持,可以通过滤镜来实现这样的一个效果 background-size:contain; // 缩小图片来适应元素的尺寸(保持像 ...

  9. 【python】How to change the Jupyter start-up folder

    Copy the Jupyter Notebook launcher from the menu to the desktop. Right click on the new launcher and ...

  10. NullpointerException真的一定要被预防?

    毫无疑问,空指针NullpointerException是我们最常遇到异常,没有之一! 在刚进入编程职业时,我想,大部分进入的同学肯定会受到前辈们的叮咛:一定要防止空指针,这是个低级错误.你们不是?好 ...