【问题标题】:IBMCloud - Connecting to PostgreSQL DB through JDBC (SSL Enabled)IBMCloud - 通过 JDBC 连接到 PostgreSQL DB(启用 SSL)
【发布时间】:2019-07-31 12:16:12
【问题描述】:

我正在尝试使用 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)

我已按照文档 - 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");

【问题讨论】:

    标签: ibm-cloud postgresql-9.6 jdbc-postgres


    【解决方案1】:

    失踪

    props.setProperty("sslkey","/opt/hb/postgres_cert/postgresql.key");

    【讨论】:

      猜你喜欢
      • 2019-02-19
      • 2021-11-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多