Access to the SQL Server database engine is achieved using one of three protocols.

By default, SQL Server accepts connections using the Shared Memory protocol.

It may interest you to know that SQL Server supports two others - Named Pipes and TCP/IP.

Some drivers, like the SQL Server JDBC Driver requires you to have the TCP/IP protocol enabled.

If you don’t, you will get an error like this.

[08S01] The TCP/IP connection to the host localhost, port 1433
has failed. Error: "Connection refused: no further information.
Verify the connection properties. Make sure that an instance of
SQL Server is running on the host and accepting TCP/IP
connections at the port. Make sure that TCP connections to the
port are not blocked by a firewall.".

If you are connected to the database engine using SQL Server Management Studio or a tool like Jetbrains DataGrip you can check how you are connected using this query:

SELECT
    net_transport
FROM
    sys.dm_exec_connections
WHERE
    session_id = @@SPID;

If you are using SQL Server 2019 you can enable TCP as follows:

  1. Hit Win + R, to open the run command
  2. Paste the following in the dialog

    SQLServerManager15.msc

  3. With the dialog looking as below, press enter.

  4. You should see the following:

  5. Expand this node to see the protocols configured.

  6. You will see that TCP/IP is disabled. Double click to open the configuration.

  7. Set enabled to Yes then press OK to accept the changes.

  8. Finally, restart the SQL Server service so that this change is accepted.

From an Administrative Powershell window, run the following command.

Restart-Service MSSQLSERVER -force

Once done you can try again to connect.

You should now be able to connect successfully.

If you’re using a different version of SQL Server, these are the names of the MMC consoles to launch.

Version Snap In Name
SQL Server 2019 SQLServerManager15.msc
SQL Server 2017 SQLServerManager14.msc
SQL Server 2016 SQLServerManager13.msc
SQL Server 2014 (12.x) SQLServerManager12.msc
SQL Server 2012 (11.x) SQLServerManager11.msc

Happy hacking!