【问题标题】:Enabling SSL with MySQL RDS in Hibernate在 Hibernate 中使用 MySQL RDS 启用 SSL
【发布时间】:2012-03-15 23:28:36
【问题描述】:

我正在尝试从 Hibernate 安全地连接到 RDS 实例。我的 hibernate.cfg 文件中的相关属性如下所示。

<property name="connection.url">
            jdbc:mysql://<endpoint>/<db>?autoReconnect=true&amp;useUniCode=true&amp;characterEncoding=UTF-8&amp;useSSL=true     
</property>
<property name="dialect"> org.hibernate.dialect.MySQLDialect </property>    
<property name="connection.verifyServerCertificate">false</property>
<property name="connection.requireSSL">true</property>

但我遇到了以下异常。

Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

我是否也需要在我的 RDS 实例上进行一些配置?

谢谢,

【问题讨论】:

    标签: java mysql amazon-web-services amazon-rds


    【解决方案1】:

    我能够解决这个问题,但还不知道根本原因。

    以某种方式单独添加这些连接属性不起作用,但是当我将它们作为参数添加到连接 URL 中时,它起作用了。

     jdbc:mysql://<endpoint>/<db>?autoReconnect=true&useUniCode=true&characterEncoding=UTF-8&useSSL=true&verifyServerCertificate=false&requireSSL=true
    

    【讨论】:

      猜你喜欢
      • 2016-03-15
      • 2018-06-24
      • 2014-06-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-27
      • 2020-04-28
      相关资源
      最近更新 更多