title: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "PKIX path building failed:
body: <p>I'm new to SQL(Microsoft SQL Server Management) and I am trying to connect it with IntelliJ</p>
  <p>I am getting the following error:
  com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: &quot;PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target&quot;.</p>
  <pre><code>import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.ResultSet;
  import java.sql.Statement;
  
  public class MyJDBC {
  
  public static void main(String[] args) {
  
  
      String  connectionURL = &quot;jdbc:sqlserver://localhost:10020;databaseName=mydatabase;user=me;password=random_password&quot;;
      try {
          System.out.print(&quot;Connecting to the server......&quot;);
          try (Connection connection = DriverManager.getConnection(connectionURL))   {
              System.out.println(&quot;Connected to the Server.&quot;);
          }
      }catch (Exception e){
          System.out.println(&quot;I am not connected to the Server&quot;);
          e.printStackTrace();
      }
  }
  }
  </code></pre>
  <p>I have this on my lib
  <a href="https://i.stack.imgur.com/FlaRU.png" rel="noreferrer">LIB</a></p>
  <p>Any help is appreciated it!</p>