[英]IBMCloud - Connecting to PostgreSQL DB through JDBC (SSL Enabled)
I am trying to connect to IBM Cloud PostgreSQL DB with Java (SSL Enabled. But while making a connection, i get the following error -我正在尝试使用 Java(启用 SSL)连接到 IBM Cloud PostgreSQL DB。但是在建立连接时,我收到以下错误 -
[7/31/19 10:48:46:952 UTC] 0000007a id= R org.postgresql.util.PSQLException: SSL error: Received fatal alert: handshake_failure
[7/31/19 10:48:46:953 UTC] 0000007a id= R at org.postgresql.ssl.MakeSSL.convert(MakeSSL.java:42)
[7/31/19 10:48:46:953 UTC] 0000007a id= R at org.postgresql.core.v3.ConnectionFactoryImpl.enableSSL(ConnectionFactoryImpl.java:441)
[7/31/19 10:48:46:953 UTC] 0000007a id= R at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:94)
[7/31/19 10:48:46:953 UTC] 0000007a id= R at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:192)
[7/31/19 10:48:46:954 UTC] 0000007a id= R at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
[7/31/19 10:48:46:954 UTC] 0000007a id= R at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:195)
[7/31/19 10:48:46:954 UTC] 0000007a id= R at org.postgresql.Driver.makeConnection(Driver.java:458)
[7/31/19 10:48:46:954 UTC] 0000007a id= R at org.postgresql.Driver.connect(Driver.java:260)
[7/31/19 10:48:46:954 UTC] 0000007a id= R at java.sql.DriverManager.getConnection(DriverManager.java:675)
[7/31/19 10:48:46:955 UTC] 0000007a id= R at java.sql.DriverManager.getConnection(DriverManager.java:219)
I had followed docs - https://cloud.ibm.com/docs/services/databases-for-postgresql?topic=databases-for-postgresql-external-app&locale=de to create the ssl certificate我按照文档 - https://cloud.ibm.com/docs/services/databases-for-postgresql?topic=databases-for-postgresql-external-app&locale=de创建了 ssl 证书
Using the self-signed certificate
Copy the certificate information from the Connections panel or the Base64 field of the connection information.
If needed, decode the Base64 string into text.
Save the certificate to a file. (You can use the Name that is provided or your own file name).
Provide the path to the certificate to the driver or client.
String url = "jdbc:postgresql://**********.databases.appdomain.cloud:31260/ibmclouddb";
Properties props = new Properties();
props.setProperty("ssl","true");
props.setProperty("user","ibm_cloud_********");
props.setProperty("password","**************");
props.setProperty("sslmode","verify-full");
props.setProperty("sslcert","/opt/hb/postgres_cert/PGSSLCERT.crt"); props.setProperty("sslfactory","org.postgresql.ssl.jdbc4.LibPQFactory");
missing丢失的
props.setProperty("sslkey","/opt/hb/postgres_cert/postgresql.key"); props.setProperty("sslkey","/opt/hb/postgres_cert/postgresql.key");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.