Reputation: 1
I am trying to connect to a SQL Server database from expressjs using mssql
, but I keep getting this:
I am following the example from https://www.npmjs.com/package/mssql#connections-1
The code in my app.js is as follows
const config = {
//user: '',
//password: '',
server: 'LAPTOP-A7INMDKJ',
database: 'dbone'
}
sql.on('error', (err)=> {
// error handler
});
sql.connect(config).then(
(pool) =>{
return pool.request()
.query('select * from course');
}).
then(result=> {
console.log('dasdasdsa');
console.log(result);
}).
catch( (err)=>{
console.log(err);
});
I Component services I have this
and in computer management tcp/ip is enabled
What am I doing wrong? I am using Windows authentication for SQL Server.
Upvotes: 0
Views: 292
Reputation: 89396
The normal troubleshooting process is to verify:
Server is listening on [ 'any' <ipv4> 1433].
Test-NetConnection -ComputerName [sqlserverhostname] -Port 1433
Upvotes: 1