使用的是tedious去连接mssql var Connection = require(‘tedious’).Connection; var config = { userName: “test”, password: “test”, server: “114.xx.xx.xxx”, database: “xxxxx” , instanceName: “SQL_Instance” }; var connection = new Connection(config); connection.on(‘connect’, function (err) { if (err) console.log(err); });
服务器上的SQL不是默认实例,通过SSMS去连接是这样的: server_ip\实例名
Node去连接,输出的错误是: { [ConnectionError: Failed to connect to 114.xx.xx.xxx:1433 - connect ECONNREFUSED 114.xx.xx.xxx:1433] message: ‘Failed to connect to 114.xx.xx.xxx:1433 - connect ECONNREFUSED 114.xx.xx.xxx:1433’, code: ‘ESOCKET’ }
求大侠帮忙看看问题