Created an Azure SQL server machine and I am able to rdp as well as connect via the local SQL Server Mgt Studio client.
However I cannot connect to the same instance via Java code using the connection string further below.
- I am using the latest JDBC Driver (Microsoft JDBC Driver 7.4)
- I am using SQL Server 2017 Express
- I am able to connect manually via SQL Server Mgt Studio client on local machine
Here is the error message:
com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target". ClientConnectionId:xxxxxxxxxxxxxxxxxx
Here is the connection string:
jdbc:sqlserver://Server=nn.nnn.nnn.nnn;Integrated Security=false;User ID=myusername;Password=mypassword
Thanks for your help!