使用mssql的sails.js中的SQL Server数据库configuration错误

我试图连接到我的sails.js项目的SQL Server数据,我用mssql连接到数据库。

我没有任何命名的实例,我login使用Windows身份validation,到目前为止我写在我的testController.js

 /** * testController * * @module :: Controller * @description :: A set of functions called `actions`. * * Actions contain code telling Sails how to respond to a certain type of request. * (ie do stuff, then send some JSON, show an HTML page, or redirect to another URL) * * You can configure the blueprint URLs which trigger these actions (`config/controllers.js`) * and/or override them with custom routes (`config/routes.js`) * * NOTE: The code you write here supports both HTTP and Socket.io automatically. * * @docs :: http://sailsjs.org/#!documentation/controllers */ module.exports = { /** * Action blueprints: * `/new/index` * `/new` */ index: function(req, res) { var config = { // user: '(local)', // password: '', //server: 'localhost', // You can use 'localhost\\instance' to connect to named instance server: '192.168.0.109', // You can use 'localhost\\instance' to connect to named instance database: 'test', options: { //encrypt: true // Use this if you're on Windows Azure trustedConnection: true, // port: 1444 } } var sql = require('mssql'); var connection = new sql.Connection(config, function(err) { if (err) { console.log("Error opening the connection!", err); return; } conn.queryRaw("SELECT TOP 10 FirstName, LastName FROM Person.Person", function(err, results) { if (err) { console.log("Error running query!"); return; } for (var i = 0; i < results.rows.length; i++) { console.log("FirstName: " + results.rows[i][0] + " LastName: " + results.rows[i][1]); } }); }); }, _config: {} }; 

但这是触发错误

打开连接时出错! {[ConnectionError:用户login失败''。]
名称:'ConnectionError',
消息:'用户login失败'',
代码:'ELOGIN'}

我真的很困惑,不知道在哪里可以find它的文件与windows authentication ,我能find的是trustedConnection: true,

请指导我关于这个问题。

谢谢

我可能会回答这个问题,但是mssql通常在使用Windows身份validation时遇到问题。 使用Edge.js来build立连接。