I am connecting to MySQL over SSL from my Java application. I have configured MYSQL to support SSL and generated client certificates. I have imported server CA certificate a
It is not necessary to pass keyStore
and trustStore
to java
program or set any system properties as it can be achieved via connection properties per connection!
So you can use different certificated for different connections (and applications if you are in app server).
Original answer: https://stackoverflow.com/a/51879119/173149 Relevant part:
jdbc:mysql://example.com:3306/MYDB?verifyServerCertificate=true&useSSL=true&requireSSL=true&clientCertificateKeyStoreUrl=file:cert/keystore.jks&clientCertificateKeyStorePassword=123456&trustCertificateKeyStoreUrl=file:cert/truststore.jks&trustCertificateKeyStorePassword=123456
It is documented: