I'm trying to connect to a local SQL Express server using Tedious but keep getting
failed Error: getaddrinfo ENOTFOUND
Am I using the wrong address here?
var Connection = require('tedious').Connection;
var config = {
userName: 'sa',
password: 'mypassword',
server: 'LOCALHOST\\SQLEXPRESS',
};
var connection = new Connection(config);
connection.on('connect', function(err) {
// If no error, then good to go...
if(err) {
console.log(err);
return;
}
executeStatement();
}
);
Tedious is a Node package that provides an implementation of the TDS protocol, which is used to interact with instances of Microsoft's SQL Server.
If you're trying to connect to localhost , and the ENOTFOUND error is thrown, it may mean that the localhost is missing in your hosts file.
"Microsoft style strings of hostname\instancename are not supported." - pekim
I posted the same issue on github and here is the full answer: https://github.com/pekim/tedious/issues/118
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With