Acess SQL server Data in node js/Failed to connect to localhost:1433 - Could not connect (sequence)

preview_player
Показать описание
in this video you will see the solution of below errors,
1. Failed to connect to localhost:1433 - Could not connect (sequence).

This is fetch SQL data using node js
or
get SQL data using node js

if you got error Cannot find module 'express' then run command on command prompt
npm install express

if you got error Cannot find module 'mssql' then run command on command prompt
npm install mssql

1. create table
CREATE TABLE [dbo].[tblprod](
[prodcode] [int] NOT NULL,
[prodname] [nchar](10) NULL
)

var express = require('express');
var app = express();


var sql = require("mssql");
// config for your database
var config = {
user: 'sa',
password: 'abc!1234',
server: 'localhost',
database: 'sample'
};

// connect to your database


// create Request object
var request = new sql.Request();

// query to the database and get the records


// send records as a response

});
});
});

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

It worked for me. I was using the SQL server name instead of using "localhost"

vsnaveen
Автор

Thank you it helpfull, i missed the part when you add the TCP port number in IPALL, it work for me now

jalalmankach
Автор

thank you so much,
this bug drives me crazy !! ^^

duyopham
Автор

username and password is compulsory?if we don't know about this informatio then?

pradnyakasar