title: "com.microsoft.sqlserver.jdbc.SQLServerException: SQL Server did not return a response."
body: <p>Using the code below:</p>
  
  <pre><code>package com.anonymised.anonymised.anonymised;
  
  
  import org.apache.logging.log4j.LogManager;
  import org.apache.logging.log4j.Logger;
  
  import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.SQLException;
  
  public class EntryPoint
  {
      private static Logger logger = LogManager.getLogger(EntryPoint.class);
      private static final String JDBC_DRIVER_NAME = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
  
      public static void main(String[] args)
      {
          logger.info("Service started!");
  
          try
          {
              Class.forName(JDBC_DRIVER_NAME);
          }
          catch ( ClassNotFoundException e )
          {
              logger.error("The necessary JDBC driver is not available (missing dependency?)",e);
              System.exit(CrashCodes.JDBC_DRIVER_UNAVAILABLE);
          }
  
          // Credentials for connection to the DB
          String dbURL = "anonymised:1433";
          String dbDatabaseName = "anonymised";
          String dbUsername = "anonymised";
          String dbPassword = "anonymised";
  
          String connectionUrl = "jdbc:sqlserver://"+dbURL+";" + "databaseName="+dbDatabaseName+";user="+dbUsername+";password="+dbPassword+";";
  
          try
          {
              Connection con = DriverManager.getConnection(connectionUrl);
          }
          catch (SQLException e)
          {
              logger.error("Cannot connect to the database",e);
              System.exit(CrashCodes.DATABASE_INITIAL_CONNECTION_FAILED);
          }
      }
  }
  </code></pre>
  
  <p>I get the following output:</p>
  
  <pre><code>[main] ERROR de.anonymised.anonymised.anonymised.EntryPoint - Cannot connect to the database
  com.microsoft.sqlserver.jdbc.SQLServerException: SQL Server did not return a response. The connection has been closed.
  </code></pre>
  
  <p>The user name, password, etc. are all correct and the server is accessible (I verified that by successfully creating a connection with a database administration tool).</p>
  
  <p>Why then do I get this exception?  </p>