Guest User

Untitled

a guest
Jun 26th, 2018
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. +---------------+--------------------------------+
  2. | Variable_name | Value |
  3. +---------------+--------------------------------+
  4. | have_openssl | YES |
  5. | have_ssl | YES |
  6. | ssl_ca | /var/lib/mysql/ca.pem |
  7. | ssl_capath | |
  8. | ssl_cert | /var/lib/mysql/server-cert.pem |
  9. | ssl_cipher | |
  10. | ssl_crl | |
  11. | ssl_crlpath | |
  12. | ssl_key | /var/lib/mysql/server-key.pem |
  13.  
  14. import java.sql.*;
  15.  
  16. public class MysqlConnect
  17. {
  18. public static void main (String[] args)
  19. {
  20. try
  21. {
  22. //System.setProperty("javax.net.ssl.trustStore", "cacerts");
  23. //System.setProperty("javax.net.ssl.trustStorePassword", "changeit"); ( Works with truststore values , but gives the error below without it)
  24. Class.forName("com.mysql.jdbc.Driver").newInstance();
  25. String url = "jdbc:mysql://IPAddress:3306/DBName?
  26. verifyServerCertificate=false&useSSL=true&requireSSL=true";
  27. String user = "root";
  28. String password = "password";
  29. Connection con = DriverManager.getConnection(url,user,password);
  30. }
  31. catch (Exception ex)
  32. {
  33. ex.printStackTrace();
  34. }
  35. }
  36. }
  37.  
  38. javax.net.ssl.SSLHandshakeException
  39. MESSAGE: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
  40.  
  41. STACKTRACE:
  42.  
  43. javax.net.ssl.SSLHandshakeException:
  44. sun.security.validator.ValidatorException: PKIX path building failed:
  45. sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
  46. at sun.security.ssl.Alerts.getSSLException(Unknown Source)
  47. at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
  48. at sun.security.ssl.Handshaker.fatalSE(Unknown Source) .
  49.  
  50. 1 source IP Dest IP TLSv1.2 220 Client Hello
  51. 2 Dest IP source IP TLSv1.2 1140 Server Hello, Certificate, Server Key Exchange, Server Hello Done
  52. 3 source IP Dest IP TLSv1.2 129 Client Key Exchange
  53. 4 source IP Dest IP TLSv1.2 60 Change Cipher Spec
  54. 5 source IP Dest IP TLSv1.2 99 Encrypted Handshake Message
Add Comment
Please, Sign In to add comment