Failed to connect to local SQL Server database using Tedious and Node JS
<p>I am trying to connect to SQL Server on my local machine. I am trying to use tedious and tedious-ntlm. The configuration for both is as below:</p>

<pre><code>var tds = require("tedious-ntlm");
//var tds = require("tedious");
var config = {
userName: 'pratikdb',
password: 'pratikdb',
server: '.',
options: {
    database: "TEST",
    debug: {
        packet: false,
        payload: false,
        token: false,
        data: false
    },
    encrypt: true
  }
};


http.createServer(app).listen(app.get('port'), function () {
    console.log('Express server listening on port ' + app.get('port'));
    var connection = new tds.Connection(config);
    connection.on('connect', function (err) {
        console.log(err);
    });
});
</code></pre>

<p>When I am working with tedious, I am getting this error:</p>

<blockquote>
  <p>ConnectionError: Failed to connect to .:1433 - getaddrinfo ENOTFOUND . .:1433]<br>
  message: 'Failed to connect to .:1433 - getaddrinfo ENOTFOUND . .:1433', code: 'ESOCKET' </p>
</blockquote>

<p>When I am working with "tedious-ntlm", I am getting this error:</p>

<blockquote>
  <p>Connection to .:1433 - failed Error: getaddrinfo ENOTFOUND . .:1433</p>
</blockquote>

<p>As mentioned <a href="http://pekim.github.io/tedious/getting-started.html" rel="nofollow">here</a>, I tried using ip of machine even then I am getting same error. </p>

<p><strong>Edit:</strong></p>

<p>When I modified the config as below as per suggestion by  @jmugz3:</p>

<pre><code>var config = {
    userName: 'pratikdb',
    password: 'pratikdb',
    server: 'DELL',
    options: {
        instanceName: ".",
        database: "TEST",
        debug: {
            packet: false,
            payload: false,
            token: false,
            data: false
        },
        encrypt: true
    }
};
</code></pre>

<p>I am getting error :</p>

<blockquote>
  <p>Error: Port for . not found in ServerName;DELL;InstanceName;MSSQLSERVER;IsClustered;No;Version;11.0.2100.60;tcp;1433;np;\DELL\pipe\sql\query;;</p>
</blockquote>

<p>Can anyone please help me?</p>

<p>Thanks in advance.</p>