Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getaddrinfo ENOTFOUND when using tedious in node.js

Tags:

node.js

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();
    }
  );
like image 662
Cotten Avatar asked Oct 29 '13 11:10

Cotten


People also ask

What is tedious node JS?

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.

What does Enotfound mean?

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.


1 Answers

"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

like image 157
Cotten Avatar answered Oct 25 '22 18:10

Cotten