Questions tagged [node-mssql]

node-mssql MSSQL database connector for Node.js.

https://tediousjs.github.io/node-mssql/

An easy-to-use MSSQL database connector for Node.js.

There are some TDS modules which offer functionality to communicate with MSSQL databases but none of them does offer enough comfort - implementation takes a lot of lines of code. This module make work as easy as it could without losing any important functionality. node-mssql uses other TDS modules as drivers and offer easy to use unified interface. It also add extra features and bug fixes.

202 questions
77
votes
12 answers

Node.js MSSQL tedius ConnectionError: Failed to connect to localhost:1433 - connect ECONNREFUSED

I am trying to connect to MSSQL 2012 using NodeJS with the mssql connection interface. When attempting to connect I get the following error: { [ConnectionError: Failed to connect to localhost:1433 - connect ECONNREFUSED] name: 'ConnectionError', …
Matt Carrier
  • 5,602
  • 6
  • 26
  • 30
73
votes
15 answers

Node.js and Microsoft SQL Server

Is there any way I can get my Node.js app to communicate with Microsoft SQL? I haven't seen any MS SQL drivers out there in the wild? I'm putting a very simple app together and need to be able to communicate with an existing MS SQL database…
Khuram Malik
  • 1,475
  • 3
  • 18
  • 30
33
votes
6 answers

How can I use a single mssql connection pool across several routes in an Express 4 web application?

I want to use node-mssql as a MSSQL database connector in a Node JS Express 4 web application. Route handler logic is handled in separate files. How do I create a single/global connection pool and use it across several files where route logic is…
Christiaan Westerbeek
  • 10,619
  • 13
  • 64
  • 89
17
votes
7 answers

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 Wizard Did It
  • 3,614
  • 4
  • 28
  • 32
8
votes
4 answers

Node.js mssql error: tedious deprecated The default value for `config.options.enableArithAbort` will change from `false` to `true`

I get the error below. How do I fix it? tedious deprecated The default value for `config.options.enableArithAbort` will change from `false` to `true` in the next major version of `tedious`. Set the value to `true` or `false` explicitly to silence…
Math
  • 399
  • 1
  • 6
  • 14
8
votes
1 answer

connect to Sql Server with Active Directory from nodejs on a linux machine

I have a nodejs service which runs on a linux machine. I need to connect to Sql Server (Mssql). I am Using mssql package and I don't see any support in connecting with AD. There is also an Azure Keyvault which we are able to connect to with the MSI…
Mithir
  • 2,355
  • 2
  • 25
  • 37
8
votes
3 answers

Node js: mssql [ConnectionError: Connection is closed.] name: 'ConnectionError', message: 'Connection is closed.', code: 'ECONNCLOSED'

i am getting error in npm mssql 3.0.0 with sqlserver 2012 i am creating single page application where i used restful using express . there are 4 method which executing the query and returning the data to response. for each method i am opening the…
Ajay Kumar Jaiswal
  • 352
  • 1
  • 6
  • 24
6
votes
1 answer

SQL Server connection timeout error in nodejs mssql

Always getting following error after couple of SQL statement execution. I am using var sql = require("mssql"); (node:12240) [DEP0064] DeprecationWarning: tls.createSecurePair() is deprecated. Please use tls.Socket instead. warning.js:18…
Furqan Misarwala
  • 1,743
  • 6
  • 26
  • 53
6
votes
2 answers

node-mssql Transaction insert - Returning the inserted id..?

I'm using node-mssql 3.2.0 and I need to INSERT INTO a table and return the id of the inserted record. I can successfully use sql.Transaction() to insert data, but the only parameters given to callbacks (request.query() and transaction.commit())…
Stephen Last
  • 5,491
  • 9
  • 44
  • 85
6
votes
4 answers

Connect to SQL Server with mssql for node.js

I got a error message when I connect to SQL Server with mssql module for node.js. [Error: connection to 192.168.1.101\sql:1433 - failed Error: getaddrinfo ENOENT] var config = { //driver: 'msnodesql', user: '...', password: '...', …
user3209808
  • 83
  • 1
  • 1
  • 5
5
votes
2 answers

Using Node.js to connect to Microsoft SQL Server 2008 (MSSQL) database

Possible Duplicate: Connecting to a remote Microsoft SQL server from Node.js I'm looking for an up-to-date explanation of how to connect to a MS SQL Sever 2008 using Node.js (v0.5.7) I have tried both Node.js projects on GitHub…
paperclip
  • 2,280
  • 6
  • 28
  • 39
5
votes
1 answer

Bulk inserting with Node mssql package

I'm trying to insert around 20.000 users at the same time in my MSSQL Server from a csv file. I created an API for my Angular2 application and I parsed the csv file to JSON format. But now I'm kind of stuck, I found an answer for this from more that…
Milan_w
  • 291
  • 2
  • 4
  • 17
5
votes
0 answers

NodeJS mssql multiple connections from different users

I'm developing an express-based application that makes some queries to different (different by user!) SQL Server 2008 and 2014 databases. It's different because each user belongs to a different company and each company has its own SQL Server. My app…
uNki
  • 193
  • 2
  • 13
5
votes
1 answer

Bulk insert data in mssql table using node mssql

I am using node-mssql My query file is as below BEGIN TRANSACTION DECLARE @status NVARCHAR(30); SET @status = 'create'; DECLARE @i UNIQUEIDENTIFIER; SET @i = NEWID(); DECLARE @t DATETIME2; SET @t = SYSUTCDATETIME(); IF NOT EXISTS( SELECT * FROM…
Sami
  • 3,926
  • 1
  • 29
  • 42
4
votes
2 answers

Execute prepared statement in a batch in NodeJS using node-mssql?

In java I can send multiple set of parameters of a parameterized query in one go (see code example below). How can I accomplish the same result in NodeJs, using node-mssql package? PreparedStatement ps = c.prepareStatement("INSERT INTO employees…
1
2 3
13 14