在 context.xml 中指定要用于 jdbc 的 SSL

Sum*_*uma 3 mysql ssl netbeans jdbc

我希望在使用 Jersey 和 Tomcat 的应用程序中使用我的 jdbc 连接,以使用 SSL 进行保护。mySQL 服务器已经支持 SSL,我在运行 NetBeans 的计算机上有必要的 SSL 证书文件,我可以使用 MySQL Workbench 中的 SSL 连接到 mySQL 服务器。

不安全连接的定义目前看起来像:

<Resource name="jdbc/Colabo" auth="Container" type="javax.sql.DataSource"
           maxActive="100" maxIdle="30" maxWait="10000"
           username="xxxx" password="yyyyy" driverClassName="com.mysql.jdbc.Driver"
           url="jdbc:mysql://ip.address:3306/db?autoReconnect=true"/>
Run Code Online (Sandbox Code Playgroud)

如何在 context.cml 文件的部分中指定应使用 SSL 完成连接?

Sum*_*uma 5

Inspired by an answer to a similar question - Configure spring to connect to mysql over ssl.

The SSL settings can be passed in the URL:

url="jdbc:mysql://ip.address:3306/db?autoReconnect=true&amp;verifyServerCertificate=false&amp;useSSL=true&amp;requireSSL=true"/
Run Code Online (Sandbox Code Playgroud)

我没有找到如何使该verifyServerCertificate=true选项工作的方法 - 一个人可能需要指定 CA 证书的位置,这是一些设置。