通过Node.js连接Sql Server
我想通过Node.js连接到SqlServer。
我已经尝试了很多方法和许多链接,但没有任何工作正常。 我想连接到SqlServer并获取一些数据。
请有人build议一些步骤和代码来连接SqlServer 2008. Sql-Node.js的驱动程序是什么?
我刚刚在http://tech.pro/tutorial/1848/getting-nodejs–sql-server-azure-to-work-together
var mssql = require('msnodesql'); var conn_str = "Driver={SQL Server Native Client 10.0};Server=tcp:xxxxx;Database=yyyy;Uid=zzzz;Pwd=wwww;Connection Timeout=30;"; mssql.query(conn_str, "select * from testtable", function(err, recordset) { if(err){ console.log("Got error :-( " + err); return; } recordset.forEach(function(record) { console.log("name: " + record.Name + " (" + record.ID + ")"); }); });