我正在使用节点并且我遇到了这个错误,但这只是有时会发生。但这一次是永久的。
我的配置:
var mssql = require("mssql");
var config =
{
user: "user",
password: "pass",
server: "devsv",
database: "db"
}
var db = new mssql.Connection(config);
db.connect(function(err)
{
console.log(err);
});
module.exports = db;
错误:
{ ConnectionError: Failed to connect to devsv:1433 - getaddrinfo ENOTFOUND devsv devsv:1433
at Connection.<anonymous> (/Users/user/Projects/p1/node_modules/mssql/lib/tedious.js:378:25)
at Object.onceWrapper (events.js:290:19)
at emitOne (events.js:96:13)
at Connection.emit (events.js:188:7)
at Connection.socketError (/Users/user/Projects/p1/node_modules/tedious/lib/connection.js:531:14)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at connectErrorNT (net.js:1025:8)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
name: 'ConnectionError',
message: 'Failed to connect to devsv:1433 - getaddrinfo ENOTFOUND devsv devsv:1433',
code: 'ESOCKET' }
谢谢你。