Install your own SSL trust server only for mysql jdbc

I would like to be able to connect to the MySQL server using JDBC over an SSL connection. The MySQL documentation states that we must set the system properties:

java System.setProperty("javax.net.ssl.trustStore","path_to_truststore_file"); System.setProperty("javax.net.ssl.trustStorePassword","password");

Really, it works ... for MySQL. But once I set these system properties, I canโ€™t make regular HTTPS calls to registered websites. System trust was overridden and I received an SSLHandshakeException .

I would like to be able to install trusted ONLY for MySQL JDBC connectivity. Any regular HTTPS call must use the system trust store.
How can I do that?

I found this question that may lead to an answer, but it does not seem to work.

+5
source share
1 answer

It turns out that the MySQL JDBC driver allows you to override these properties as part of the connection URL .

So I need to add &trustCertificateKeyStoreUrl=file://path_to_truststore_file&trustCertificateKeyStorePassword=password to the connection url.

+5
source

Source: https://habr.com/ru/post/1245773/


All Articles