nodejs with mssql connection timeout error
12,989
Solution 1
1.you have to run "SQL Server Browser" service.
2.enable "TCP/IP"
*you need restart "SQLEXPRESS" service
it also helps bellow error.
ConnectionError: Port for SQLEXPRESS not found in "ServerName"
Solution 2
Maybe your query takes too long.
Try to do SELECT 1 a
.
If it works - change the timeout.
Doc for requestTimeout:
Solution 3
Actually It was error from "Sql Server Configuration Manager". Tcp\Ip was disabled in Sql server network configuration.
Author by
Jitendra
mail me at : 6A6974656E6472612E6D6F7572796140796D61696C2E636F6D
Updated on June 04, 2022Comments
-
Jitendra almost 2 years
I am writing a node.js console app for communicating with SQL Server 2008.
var sql = require('mssql'); var connection = new sql.Connection({ user: 'sa', password: 'password', server: 'localhost\\SQLEXPRESS', database: 'Demo' }); connection.connect(function (err) { if (err) console.log(err); var request = new sql.Request(connection); // or: var request = connection1.request(); request.query('select * from EmpInfo', function (err, recordset) { // ... error checks console.dir(recordset); }) });
When I execute this code, a
TIMEOUT
error occurs.