Answer the question
In order to leave comments, you need to log in
How to speed up connection to MS SQL DB (tedious + NODE) in AZURE?
The code:
exports.Get = function (req, res, next) {
var Connection = require('tedious').Connection;
var id = '1';
var config = {
userName: 'user',
password: '12345',
server: 'ololoserver.com',
options: {encrypt: true, database: 'base'}
}
var connection = new Connection(config);
connection.on('connect', function(err){
if(err){
console.log(err);
}else{
request = new Request("SELECT * FROM dbo.Test WHERE id = @id ;", function(err) {
if (err) {
console.log(err);}
});
var array_j = [];
var result = "";
request.on('row', function(columns) {
columns.forEach(function(column) {
array_j.push(column.value);
});
res.json(array_j);
result ="";
});
connection.execSql(request);
}
})
};
var Request = require('tedious').Request;
var TYPES = require('tedious').TYPES;
}
Answer the question
In order to leave comments, you need to log in
1. If you have ipv6 enabled, but not configured and not used, then disable it. First, the computer name is resolved by ipv6. As a test, try replacing the server name with its ip address.
2. If you have a corporate network without access to the Internet, then when connecting, a certificate revocation check of the connecting server may be performed, which will try to connect to the certificate revocation check server. In this case, this check must be disabled in the system.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question