Node.js MSSQL tedius ConnectionError: Failed to connect to localhost:1433 - connect ECONNREFUSED

Matt Carrier picture Matt Carrier · Aug 30, 2014 · Viewed 72.5k times · Source

I am trying to connect to MSSQL 2012 using NodeJS with the mssql connection interface.

When attempting to connect I get the following error:

{ [ConnectionError: Failed to connect to localhost:1433 - connect ECONNREFUSED]
  name: 'ConnectionError',
  message: 'Failed to conncet to localhost:1433 - connect ECONNREFUSED',
  code: 'ESOCKET' }

Any ideas on how to fix this?

Answer

Matt Carrier picture Matt Carrier · Aug 30, 2014

The solution is to enable TCP connections which are disabled by default.

enter image description here