JDBC連接數據庫時警告:Establishing SSL connection without server's identity verification is not recommended.

警告信息爲:
Sat Aug 31 12:13:53 CST 2019 WARN: Establishing SSL connection without server’s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn’t set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to ‘false’. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

這段話的意思爲:
警告:不建議在不驗證服務器身份的情況下建立SSL連接。根據MySQL5.5.45+、5.6.26+和5.7.6+的要求,如果沒有設置顯式選項,那麼缺省情況下必須建立SSL連接。爲了符合不使用SSL的現有應用程序,VerifyServerCertificate屬性設置爲“false”。您需要通過設置usessl=false顯式禁用ssl,或者設置usessl=true併爲服務器證書驗證提供信任庫。

解決方案:

String url="jdbc:mysql://localhost:3306/bank?useUnicode=true&characterEncoding=UTF-8&useSSL=false";

SSL的意思爲:

SSL(Secure Sockets Layer 安全套接層),及其繼任者傳輸層安全(Transport Layer Security,TLS)是爲網絡通信提供安全及數據完整性的一種安全協議。TLS與SSL在傳輸層對網絡連接進行加密。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章