Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 379
A Wizard Did It Avatar asked Jan 18 '11 19:01

A Wizard Did It


2 Answers

Check out a new option:

https://github.com/orenmazor/node-tds

(from Node.js and Microsoft SQL Server)

like image 156
Cade Roux Avatar answered Sep 25 '22 12:09

Cade Roux


I would recommend node-mssql, which is a nice wrapper for other connectors, the default being my previous choice (Tedious) bringing a bit nicer of an interface. This is a JavaScript implimentation, with no compilation requirements, meaning you can work in windows and non-windows environments alike.

Another option, if you don't mind bringing in .Net or Mono with a binary bridge would be to use edge.js. Which can be very nice if you want to leverage .Net libraries in node.js

node-tds is abandoned, node-odbc doesn't work with windows, and the MS node-sqlserver driver doesn't seem to work on non-windows (and has some goofy requirements).

like image 28
Tracker1 Avatar answered Sep 25 '22 12:09

Tracker1