MS SqlServer driver?

225 views
Skip to first unread message

Bruno Jouhier

unread,
Apr 18, 2014, 2:24:56 PM4/18/14
to nod...@googlegroups.com
Just looked at the official driver project (https://github.com/Azure/node-sqlserver) and was very disappointed to see that it has not been updated for more than 1 year.

Tedious (https://github.com/pekim/tedious) seems to be the only really active project. Is this the right?
Anyone willing to share his/her experience with mssql drivers?

Bruno

Ben Noordhuis

unread,
Apr 18, 2014, 4:19:30 PM4/18/14
to nod...@googlegroups.com
As a datum point: all the people I know that use iisnode, also use
msnodesql a.k.a. node-sqlserver. That's a sample size of ~10 so make
of it what you will.

And yeah, the last commit was nine months ago. I'm not sure if that
means it's unmaintained or that everything just works but the open
issue count suggests it's the former.

Bruno Jouhier

unread,
Apr 18, 2014, 5:44:50 PM4/18/14
to nod...@googlegroups.com
Thanks Ben,

I took a look at it before asking and I was wondering how people can use it to stream the rows returned by very large queries. The callback API is unhelpful for this and I did not see any pause/resume API to control the flow of row events. Tedious does not seem to hande this either (but I only took a quick look).

The mysql driver gave me the right API. For oracle, I had to extend the driver with a reader API because the existing API was too simplistic. I was hoping to get this out of the box from mssql drivers but it looks like I'll have to implement it.

Bruno

Alejandro Paciotti

unread,
Apr 18, 2014, 6:04:19 PM4/18/14
to nod...@googlegroups.com
I am developing an app that has to read data from SQLSERVER. 
After much reading and testing, I decided to use mssql. 

"mssql": "*" in my package.json 
npm install 

and as an example: 

var sql = require ('mssql'); 
var database = {user = 'youruser', password = 'yourpass', server = 'localhost', database= 'yourdatabasename' port = 1433};

var connection = new sql.Connection (database, function (err) {

var request = new sql.Request (connection); 

request.query ('SELECT * FROM your_view', function (err, rsDatosClientes) {

rsDatosClientes; 
res.json (rsDatosClientes); 
}); 
});


It work for me.

Good Luck!




--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bruno Jouhier

unread,
Apr 18, 2014, 6:13:46 PM4/18/14
to nod...@googlegroups.com
Thanks Alejandro.

What if your query returns zillions of rows (and you really want them all because you are doing some kind of data pump)?
You cannot use the callback API and I did not see how you could control the flow of "row" events with the event API. Do you have any experience with this?

Did you bench the drivers? I'm curious about the performance of a C++ driver vs. a pure JS TDS driver like tedious.

Bruno

Bruno Jouhier

unread,
Apr 18, 2014, 6:24:52 PM4/18/14
to nod...@googlegroups.com
Found some bench figures here: https://github.com/patriksimek/node-mssql/issues/15. Looks like C++ driver is the fastest.

Bruno

Alejandro Paciotti

unread,
Apr 18, 2014, 6:35:44 PM4/18/14
to nod...@googlegroups.com
I have no experience with large volumes of data. 
I copied the link for you to mssql, what I had forgotten.

This library is based on tedious, which can handle events for each row. 
Maybe you could use tedious, I used this because it is much simpler and adapted to my needs.

Ale.


@siculars

unread,
Apr 18, 2014, 8:15:49 PM4/18/14
to nod...@googlegroups.com
I have successfully used the command line tool freetds[0] from node. I basically integrate it into my node app by calling out to it as a child process. Fortunately, my use case allows for non-realtime data access. I write the sql that I want to execute to file and then feed it to the freetds command line tool, tsql. The output is written to disk and delivered to the app or consumed by some other app. 

All that said, I would love to see some of these mssql driver projects move further along...

Tomasz Janczuk

unread,
Apr 18, 2014, 11:58:13 PM4/18/14
to nod...@googlegroups.com
One of the best ways to access MS SQL is to use .NET Framework's ADO.NET. You can use ADO.NET from within your Node.js application via Edge.js (http://tjanczuk.github.io/edge), which supports running CLR and Node.js code in-process and provides an interop model between the two. If your MS SQL access needs are simple (CRUD), you can use the edge-sql extension to Edge.js (https://github.com/tjanczuk/edge#how-to-script-t-sql-in-a-nodejs-application), which allows you to simply script parameterized T-SQL within your Node.js application. 

Edge.js currently only works on Windows, but support for MacOS and Linux via Mono is just around the corner (you can actually use the bits from GitHub on MacOS and Linux even today; I am performing some last rites before pushing to NPM). 

There are many folks who are using Edge.js specifically to access MS SQL via ADO.NET - this is one of the more frequent applications. The one web app I know is using Edge.js to acces MS SQL is http://www.cellartracker.com/. @danpolivy has done extensive benchmarking of available solutions to access MS SQL from Node and concluded using ADO.NET via Edge was the fastest by a large margin (~3x) compared to the next alternative. Ping @danpolivy for details.  

Bruno Jouhier

unread,
Apr 19, 2014, 5:57:42 AM4/19/14
to nod...@googlegroups.com
Thanks a lot Tomasz. This is very helpful. I'll contact Dan to have more info and I'll give it a try.

Thanks @siculars too, it won't help me as much because I'm really looking for a driver but that's good to know.
 
Bruno

Glenn Block

unread,
Apr 19, 2014, 3:46:45 PM4/19/14
to nod...@googlegroups.com
(sigh)

That's my only response when you mention the MS SQL driver. I was very optimistic when the project launched, but due to internal priorities it seems to have hit a stand still.

Fortunately there are other options. As Tomek said, using Edge to talk to SQL is rock solid and yields the best possible performance (IMO). 

I am not sure it works yet on the mono side (thought it may), but I imagine if it doesn't that's a shorter term issue.


--

Bruno Jouhier

unread,
Apr 20, 2014, 8:06:38 AM4/20/14
to nod...@googlegroups.com
Hi Glenn,

I share your feelings.

I'm a bit surprised that a pure JS implementation of TDS does not win on performance. The Edge/ADO.Net combo must be doing some really cool tricks.

Tomasz says that mono support is just around the corner. Will help me because I'm developing on Mac.

Bruno

Glenn Block

unread,
Apr 20, 2014, 2:34:02 PM4/20/14
to nod...@googlegroups.com
Edge is a passthrough to .NET code. It turns out .NET has a really powerful and robust SQL driver. When you use edge you can leverage it. 
Reply all
Reply to author
Forward
0 new messages