Failed to Connect to a Database Using mariadb-connector in SSL Mode
Scenario
A database could not be connected using JDBC, and the following error message was displayed:
unable to find certification path to requested target
Possible Causes
As shown in the figure above, the JAR package of MariaDB is used to connect to the database, which is slightly different from the official driver package of MySQL.
Solution
String url = "jdbc:mysql://xxx.xxx.xxx.xxx:xxxx/mysql?useSsl=true&serverSslCert=D:\\ca.pem&disableSslHostnameVerification=true";
Note: GaussDB(for MySQL) instances do not support hostname verification. Therefore, you need to set disableSslHostnameVerification to true. The setting method varies depending on the MariaDB JAR package version. For details, see the notes on usage of the corresponding version.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot