Ste*_*n D 6 sql-server-2008 node.js
我在使用node.js中的Microsoft的node-sqlserver连接到网络上的计算机上的数据库时遇到问题.我在Windows 2008服务器上使用sql server 2008.我在同一域内的不同机器上远程运行我的node.js. 我认为这个问题与连接字符串有关.
var sql = require('node-sqlserver');
var conn_str = 'Driver={SQL Server Native Client 10.0};Server=(win08-srv);Database=DB;Trusted_Connection={Yes}';
Run Code Online (Sandbox Code Playgroud)
此外,应该有一个用户名和密码进入数据库,但这不在节点模块的示例连接字符串中.
//open the DB connection
sql.open(conn_str, function (err, conn) {
if (err) {
console.log("Error opening the connection!");
return;
} else {
console.log('Connection successful!');
return;
}
});
Run Code Online (Sandbox Code Playgroud)
Error opening the connection!运行时始终会导致打印.
| 归档时间: |
|
| 查看次数: |
2143 次 |
| 最近记录: |