[英]Unable to connect to “Compose for PostgreSQL” DB created in bluemix through eclipse
I am not able to establish connection to Compose for PostgreSQL DB service using eclipse. 我无法使用eclipse与PostgreSQL数据库服务Compose建立连接。 Getting below error while Testing the connection. 测试连接时遇到错误。
org.postgresql.util.PSQLException: Connection 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:122)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65)
at org.postgresql.jdbc2.AbstractJdbc2Connection.(AbstractJdbc2Connection.java:116)
at org.postgresql.jdbc3.AbstractJdbc3Connection.(AbstractJdbc3Connection.java:30)
at org.postgresql.jdbc3.Jdbc3Connection.(Jdbc3Connection.java:24)
at org.postgresql.Driver.makeConnection(Driver.java:369)
at org.postgresql.Driver.connect(Driver.java:245)
at org.eclipse.datatools.enablement.internal.postgresql.PostgreSQLJDBCConnection.createConnection(PostgreSQLJDBCConnection.java:87)
at org.eclipse.datatools.connectivity.DriverConnectionBase.internalCreateConnection(DriverConnectionBase.java:105)
at org.eclipse.datatools.connectivity.DriverConnectionBase.open(DriverConnectionBase.java:54)
at org.eclipse.datatools.enablement.internal.postgresql.PostgreSQLJDBCConnection.(PostgreSQLJDBCConnection.java:47)
at org.eclipse.datatools.enablement.internal.postgresql.PostgreSQLConnectionFactory.createConnection(PostgreSQLConnectionFactory.java:51)
at org.eclipse.datatools.connectivity.internal.ConnectionFactoryProvider.createConnection(ConnectionFactoryProvider.java:83)
at org.eclipse.datatools.connectivity.internal.ConnectionProfile.createConnection(ConnectionProfile.java:359)
at org.eclipse.datatools.connectivity.ui.PingJob.createTestConnection(PingJob.java:76)
at org.eclipse.datatools.connectivity.ui.PingJob.run(PingJob.java:59)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
I am able to connect to the DB through the application deployed in BlueMix. 我能够通过BlueMix中部署的应用程序连接到数据库。
How are you populating the connection credentials? 您如何填充连接凭据? The application will have access the VCAP_SERVICES when run on Bluemix, but unless you have specifically copied that environment variable to your Eclipse environment, that information will not be available to your application. 当在Bluemix上运行时,该应用程序将有权访问VCAP_SERVICES,但是除非您已将该环境变量专门复制到Eclipse环境,否则该信息将对您的应用程序不可用。
The error indicates that the connection was refused. 该错误表明连接被拒绝。 This most likely means that the host and port combination you've entered is incorrect. 这很可能意味着您输入的主机和端口组合不正确。 You'll want to ensure that you can connect to the host. 您需要确保可以连接到主机。
You can check that your local system can connect by doing nc -vz xxxxx.dblayer.com 10000
where xxxxx.dblayer.com
is the full hostname provided to you within the variable and 10000
is the port, also provided. 您可以通过执行nc -vz xxxxx.dblayer.com 10000
来检查本地系统是否可以连接,其中xxxxx.dblayer.com
是变量中提供给您的完整主机名,端口10000
是也提供的端口。
It seems as though your syntax/configuration may not be correct as a connection being refused would indicate that it cannot connect however it's not clear from your post what hostname/port it's actually trying to connect to. 似乎您的语法/配置可能不正确,因为被拒绝的连接将表明它无法连接,但是从您的帖子中尚不清楚它实际上试图连接的主机名/端口。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.