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
0
votes
2 answers

Cannot insert the value NULL into column 'customer_id' but customer_id does have value

I'm using MSSQL bulk function to insert data into the database. The column customer_id does exist in the table. When I debug and see the values that's in table.rows.push(map), I can see property customer_id and it has a integer value. I also…
Kestal
  • 173
  • 1
  • 2
  • 10
0
votes
1 answer

Async not awaiting the function to complete before executing next line

I'm using node-mssql. The line return res.send(result) is executed before var result = await client(3), this should not be the case because I have await on var result = await client(3). After debugging I came to a point where the following code is…
Kestal
  • 173
  • 1
  • 2
  • 10
0
votes
1 answer

Invalid column type from bcp client for colid

I'm building an app for proof of concept. I have an endpoint which reads data from a JSON file and the JSON data should then be bulk inserted into the database. The table in the database gets created correctly but data doesn't get added into the…
Kestal
  • 173
  • 1
  • 2
  • 10
0
votes
2 answers

What is the best design for a Node application using 'mssql' library that handles many requests per day?

I'm trying to optimize (and safeguard against crashes/errors) my application which will need to execute hundreds or thousands of SQL queries daily, and I'm wondering what the best design/setup is for mssql. I know it probably wouldn't be efficient…
0
votes
0 answers

Node-mssql not able to connect to the server but with tedious it connects

currently i'am using tedious package to connect to the database and do operations but i would like to switch to node-mssql (seems less messy). The problem i'm getting is connection timeout: originalError: ConnectionError: Failed to connect to…
Singh
  • 783
  • 1
  • 6
  • 24
0
votes
1 answer

node-mssql error message when trying to do a bulk insert (While reading current row from host, a premature end-of-message was encountered)

When trying to use the .bulk operation of node-mssql lib in node.js, i'm receiving the message: While reading current row from host, a premature end-of-message was encountered--an incoming data stream was interrupted when the server expected to see…
v1d3rm3
  • 454
  • 5
  • 12
0
votes
1 answer

Type 'Promise & void' is missing the following properties from type 'ConnectionPool'

I'm trying to make a connection and returning the pool using the mssql package. const sqlConfig = { user: process.env.DB_USER, password: process.env.DB_PASS, database: process.env.DB_CATALOG, server: process.env.SERVER_HOST } export…
0
votes
0 answers

Failed to connect SQL Server from Node.js using tedious

I am trying to connect to SQL Server in our domain network. I am able to connect using python but not able to connect in Node.js using Tedious. Node.js code snippet: var config = { server: 'serverName.domain.com', …
Sudheer
  • 1
  • 4
0
votes
0 answers

node.js mssql UPDATE Statements take > 1 minute to execute

At the moment I am deploying a node.js application with IIS reverse proxy at a test server. I am working with mssql package to connect to the SQL Server 2014. For testing on my local machine everything worked fine (SQL Server 2019), but now on the…
lukinoe
  • 21
  • 4
0
votes
2 answers

NodeJs : bulk insert into SQL Server one-to-many

I want to using nodejs mssql package to bulk insert data with below json: [ { "name": "Tom", "registerDate": "2021-10-10 00:00:00", "gender": 0, "consumeRecord":[ { "date": "2021-10-11…
Dogrammer
  • 35
  • 6
0
votes
1 answer

How to integrate a sql connection lib properly in NestJS

I'm wondering if there's a good pratice in order to use the library "mssql" in NestJS, whether if I should make a new module (and how, I'm pretty new to NestJS) or something else to implement singleton pattern for example. I also noticed that the…
LMinato
  • 43
  • 1
  • 3
0
votes
1 answer

How to mock SQL Server connection pool in node

I am attempting to mock SQL Server connection pool so that I can test the function of a DAL. I have a connection pool file connectionPool.js const sql = require('mssql'); const log = require('../services/logger'); const config = { user:…
Ian MacRae
  • 41
  • 2
  • 7
0
votes
1 answer

Does npm mssql supports authentication type azure-active-directory-access-token to connect to azure sql server

I have read that mssql module uses Tedious internally to connect to azure sql db. Hence i am trying to establish a connection using azure-active-directory-access-token. However, i am getting error as ConnectionError: Login failed for user…
0
votes
0 answers

Understanding TypeScript pattern with MSSQL

I've recently been given this Node.js + TypeScript project and I'm trying to understand why the original author (not available to answer this question) uses a particular pattern to create a database connection pool with node-mssql. Basically, the…
user199710
  • 315
  • 1
  • 3
  • 8
0
votes
1 answer

How to use node-mssql query SQL Server Error [ERR_HTTP_HEADERS_SENT]?

const request = new sql.Request(transaction) request.query('select * from TB_USER', (err, result) => { if (err) { res.send(err); transaction.rollback(err => { console.log("Transaction…