3765209 [Druid-ConnectionPool-Create-146186969] com.alibaba.druid.pool.DruidDataSource.run:2815| create connection SQLException, url: jdbc:postgresql://10.251.150.35:5432/adverse, errorCode 0, state 08001 org.postgresql.util.PSQLException: Connection to 10.251.150.35:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:285) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49) at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:217) at org.postgresql.Driver.makeConnection(Driver.java:458) at org.postgresql.Driver.connect(Driver.java:260) at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:118) at com.alibaba.druid.filter.FilterAdapter.connection_connect(FilterAdapter.java:764) at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:112) at com.alibaba.druid.filter.stat.StatFilter.connection_connect(StatFilter.java:232) at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:112) at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1645) at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1709) at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2813) Caused by: java.net.ConnectException: 拒绝连接 (Connection refused) at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:607) at org.postgresql.core.PGStream.<init>(PGStream.java:81) at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:93) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:197)
时间: 2023-12-30 14:06:44 浏览: 220
java使用druid1.0.1数据库连接池demo.zip
根据错误信息显示,连接到 PostgreSQL 数据库服务器失败。错误提示中提到了 "Connection to 10.251.150.35:5432 refused",这意味着连接被拒绝,可能是由于以下原因导致的:
1. PostgreSQL 数据库服务器没有在指定的 IP 地址和端口上监听。确保数据库服务器正在运行,并且监听的 IP 地址和端口号与连接字符串中的一致。
2. 防火墙或网络配置阻止了从你的应用程序所在的网络中访问数据库服务器。请检查防火墙设置和网络配置,确保允许从应用程序所在的网络访问数据库服务器。
3. 数据库服务器配置限制了仅接受本地连接或特定 IP 地址的连接。请检查 PostgreSQL 数据库的配置文件,确保允许远程连接。
请根据以上提示逐一排查,如果问题仍然存在,请提供更多细节或相关代码,我将尽力帮助你解决问题。
阅读全文