could not connect sql localhost in node js or how to connect sql server with localhost in node js

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

var express = require('express');
var app = express();
app.get('/', function (req, res) {
var sql = require("mssql");
// config for your database
var config = {
user: 'test123',
password: 'test',
server: 'localhost',
database: 'node_db'
};
// connect to your database
sql.connect(config, function (err) {
if (err) console.log(err);
// create Request object
var request = new sql.Request();
// query to the database and get the records
request.query('select distinct * from tblstudent', function (err, recordset) {
if (err) console.log(err)
// send records as a response
res.send(recordset);
});
});
sql.close();
});
var server = app.listen(5000, function () {
console.log('Server is running..');
});

rinkuchoudhary
Автор

I tried to connect my local database with windows authentication in my node app but it's throwing expections while making connections.

ayushtyagi
Автор

I have an error in connection , can you tell me we can set local_net_address & local_tcp_port in sys.dum_connections table set.
In my case it's value is going to return me null, in fact it's value should be set 127.o.o.1, or port no someone must be return, is you have solution of this problem, plz share with

ranashahid
Автор

Hello, im having this error: ConnectionError: Cannot close a pool while it is connecting.

Can u help me?

xxthend
Автор

const mssql = require('mssql');
var dbConfig = {
user: 'sa',
password: 'test123',
server: 'localhost',
database: 'node_db'
};
const ConnectDB = new
.connect()
.then(pool => {
console.log('Connected to MSSQL!')
return pool
})
.catch(err => console.log('Database Connection Failed! Bad Config: ', err))

rinkuchoudhary
Автор

Server is running..
tedious deprecated The default value for will change from `false` to `true` in the next
major version of `tedious`. Set the value to `true` or `false` explicitly to silence this message.


please help

vishalvishal
Автор

Not working . unable to create and connect new database login sql

snehalshinde
Автор

Your back ground music is too loud and distracting

sigmiami
Автор

Server is running..
tedious deprecated The default value for will change from `false` to `true` in the next major version of `tedious`. Set the
value to `true` or `false` explicitly to silence this message.
(node:8360) ConnectionError: Cannot close a pool while it is connecting
at ConnectionPool._close



please help

MrKannan