i have written a simple storedProcedure call in my app..
var sql = require('mssql');
var pool = require('./pool');
var Connection = require('tedious').Connection;
var connection = new sql.Connection(pool);
connection.connect(function(err) {
if (err) { res.status(500).send(err); return; }
var request = new sql.Request(connection);
var sqlString = ''spname'';
request.execute(sqlString, function(err, recordsets, returnValue) {
if (err) { res.status(500).send(err); return; }
res.send(recordsets);
connection.close();
});
});
and the pool.js has below code
var pool = {
server: servername,
database: dbname,
user:username,
password:password,
options:{
tdsVersion: '7_4',
instanceName : 'sqlexpress2012',
connectTimeout : 60000,
requestTimeout : 0
},
driver: 'tedious'
};
I am getiing response on the first time..it works fine....
but when i send the request again(second time as a parallel requests) it sends me the below error....
in console --> uncaughtException: false == true
In response --->{
"name": "ConnectionError",
"message": "Failed to connect to 192.168.1.200:undefined in 60000ms",
"code": "ETIMEOUT"
}
i have even changed the timeout time.. still the above error comes for me..
is there anything in my code to be changed??..some one please help me...
Exception has occurred: ConnectionError
ConnectionError: Failed to connect to database.windows.net:1433 in 15000ms
at Connection.tedious.once.err (d:\Projects\node_modules\mssql\lib\tedious.js:216:17)
at Object.onceWrapper (events.js:316:30)
at emitOne (events.js:115:13)
at Connection.emit (events.js:210:7)
at Connection.connectTimeout (d:\Projects\\node_modules\tedious\lib\connection.js:795:12)
at ontimeout (timers.js:469:11)
at tryOnTimeout (timers.js:304:5)
at Timer.listOnTimeout (timers.js:264:5)
I am also facing the same issue, Please help struggling from last 10 hrs.
@furqanms @nir777 Try upgrading to the latest version of this library which has improved connection lifecycle management. I'm confident that should resolve the problem. If not, then reopen and let us know the database platform you're running on (Azure, bare metal, etc)
Most helpful comment
I am also facing the same issue, Please help struggling from last 10 hrs.