Hibernate,c3p0,PostgreSQL:没有连接,因为目标机器主动拒绝它

时间:2014-07-06 20:35:11

标签: java hibernate postgresql c3p0 pgadmin

当我使用Hibernate池时,一切都很完美。但是,当我尝试将池更改为c3p0时,我没有从客户端获得任何错误(初始化c3p0没有错误)但我得到了#34;没有连接可能是是因为目标机器主动拒绝了它#34;与c3p0尝试进行的每个连接(在本例中为5)。

我在pgadmin III日志中看到此消息"服务器状态"

我完成了我的研究,没有任何作用。 我做了什么:

  • 更改了配置,没有结果
  • 入站/出站端口5432防火墙已启用

配置 - postgres

listen_addresses = '*'      # what IP address(es) to listen on;
                # comma-separated list of addresses;
                # defaults to 'localhost'; use '*' for all
                # (change requires restart)
port = 5432             # (change requires restart)
max_connections = 100           # (change requires restart)

配置 - pg_hba

# IPv4 local connections:
host     all     all     0.0.0.0/0   md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#host    replication     postgres        127.0.0.1/32            md5
#host    replication     postgres        ::1/128                 md5
host     all     all     127.0.0.1/24    md5

Hibernate cfg:

<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/{db_name}</property>

<property name="hibernate.c3p0.acquire_increment">1</property>
<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.max_size">20</property>
<property name="hibernate.c3p0.timeout">1000</property>
<property name="hibernate.c3p0.max_statements">50</property>
<property name="hibernate.c3p0.idle_test_period">1000</property>

重要的是:它确实以某种方式工作(在需要时建立单个连接)但似乎c3p0无法建立池服务器端

0 个答案:

没有答案
相关问题