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

前端 未结 10 1630
情话喂你
情话喂你 2020-12-09 01:37

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

When attempting to connect I get the following error:

{ [Conn         


        
10条回答
  •  臣服心动
    2020-12-09 01:44

    Best practice is to first verify the connection to the SQL server using a query analyzer (SQL Management Studio (Windows) or SQLPro for MSSQL (Mac)) using the same protocol, port and credentials as you wish to use via your application.

    In Management Studio, the format is Server,Port (e.g. 192.168.1.10,1433); and you'll probably be using SQL Server Authentication instead of Windows Authentication.


    Steps to configure the SQL Server:

    Install with Mixed Authentication, if you intend to use SQL Server Authentication.

    Setup SQL Server to listen on TCP on a fixed port number:

    • SQL Configuration Manager SQL Server Network Configuration
      • Protocols for {Instance}
        • TCP/IP - Enabled (double-click)
        • IP Address (on all desired interfaces)
          • TCP Dynamic Ports = BLANK! (not zero)
          • TCP Port - 1433 (or desired port)

提交回复
热议问题