title: Communications link failure JDBC Java
body: <p>I know there are tons of similar questions that have been answered, but I've searched pretty much all of them and can't figure out the solution to my issue.</p>
  
  <p>I am trying to connect to my SQL database with the below code, but I am getting an error. Before I show my code, I am able to connect to the same database using <code>DBeaver</code> with the below connection details:</p>
  
  <p><a href="https://i.stack.imgur.com/HiaDl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HiaDl.png" alt="enter image description here"></a></p>
  
  <p>I am trying to connect to the database by doing:</p>
  
  <pre><code>Connection connection = DriverManager
                      .getConnection("jdbc:mysql://localhost:1433/master", "sa", "MY_PASSWORD_HERE");
  </code></pre>
  
  <p>However, at this point, my code doesn't throw any error, but it throws the below error after about 2 minutes, which I assume it has basically given up and timed out.</p>
  
  <pre><code>com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
  
  The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
  </code></pre>
  
  <p>I have no idea what I'm doing wrong as I've followed the same procedures as the countless tutorials online. Any help is appreciated.</p>
  
  <p>For reference, I am building my project with Maven. Here is a snippet of the <code>pom.xml</code></p>
  
  <pre><code>&lt;dependency&gt;
     &lt;groupId&gt;mysql&lt;/groupId&gt;
     &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
     &lt;version&gt;8.0.19&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p><strong>EDIT:</strong> running <code>SELECT @@VERSION</code> returns:</p>
  
  <pre><code>Microsoft SQL Server 2019 (RTM-CU4) (KB4548597) - 15.0.4033.1 (X64) 
      Mar 14 2020 16:10:35 
      Copyright (C) 2019 Microsoft Corporation
      Developer Edition (64-bit) on Linux (Ubuntu 18.04.4 LTS) &lt;X64&gt;
  
  1 row(s) returned
  
  Executed in 1 ms
  </code></pre>