A Wizard Did It A Wizard Did It - 1 year ago 220
Node.js Question

Connecting to a remote Microsoft SQL server from Node.js

I was wondering if anyone was aware of a way to connect to a Microsoft SQL database from Node.js. I'm aware of the MySQL drivers, but I have data that I need to pull from a MS SQL database and would rather pull directly from Node.js rather than hack a PHP script of some sort in place.

Answer Source

I suspect you'll have to wrap your SQL Server with a JSON outputting web-service. On the positive side, it should be relatively easy to do.

Be nice if the JavaScript engine in node.js could do this: (from How to connect to SQL server database from javascript?):

var connection = new ActiveXObject("ADODB.Connection") ;

var connectionstring="Data Source=<server>;Initial Catalog=<catalog>;User ID=<user>;Password=<password>;Provider=SQLOLEDB";

var rs = new ActiveXObject("ADODB.Recordset");

rs.Open("SELECT * FROM table", connection);