title: Timeout error while connecting to SQL Server: Connection Error: Failed to connect to servername\instancename in 15000ms
body: <p>The error code is code <code>ETIMEOUT</code>. I am using SQL Server 2014, NodeJs version v12.16.2 and I am running this code in Visual Studio Code.</p>
  
  <p>I have created the database and the table is also created with some records. For the server name, I have also tried giving the FQDN, but it didn't work. </p>
  
  <p>This is the code snippet:</p>
  
  <pre><code>const express = require('express');
  const app = express();
  var Connection = require('tedious').Connection;
  var Request = require('tedious').Request;
  app.get('/', function(req, res) {
     res.send('&lt;hHii&lt;/h');
  });
  const sql = require('mssql');
  var config = {
     user: 'domain\username',
     password: 'mypwd',
     server: 'servername',
     host: 'hostname',
     port: '1433',
     driver: 'tedious',
     database: 'DBname',
     options: {
        instanceName: 'instancename'
     }
  };
  sql.connect(config, function(err) {
     if (err)
        console.log(err);
     let sqlRequest = new sql.Request();
     //var sqlRequest = new sql.Request(connection)
     let sqlQuery = 'SELECT * from TestTable';
     sqlRequest.query(sqlQuery, function(err, data) {
        if (err) console.log(err);
        console.log(data);
        //console.table(data.recordset);
        // console.log(data.rowAffected);
        //console.log(data.recordset[0]);
        sql.close()
     });
  });
  const webserver = app.listen(5000, function() {
     console.log('server is up and running....');
  });
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>tedious deprecated The default value for `config.options.enableArithAbort` will change from `false` to `true` in the next major version of `tedious`. Set the value to `true` or`false` explicitly to silence this message.   
  
  node_modules\mssql\lib\tedious\connection-pool.js:61:23  
  server is up and running....  
  
  ConnectionError: Failed to connect to servername\instantname in 15000ms
  
  at Connection.&lt;anonymous(..\SQL\Sample\sample\node_modules\mssql\lib\tedious\connection-pool.js:68:17)  
  at Object.onceWrapper (events.js:417:26)  
  at Connection.emit (events.js:310:20)  
  at Connection.connectTimeout (..\SQL\Sample\sample\node_modules\tedious\lib\connection.js:1195:10)  
  at Timeout._onTimeout (..\SQL\Sample\sample\node_modules\tedious\lib\connection.js:1157:12)  
  at listOnTimeout (internal/timers.js:549:17)  
  at processTimers (internal/timers.js:492:7) {  
     code: 'ETIMEOUT',
     originalError: ConnectionError: Failed to connect to INPUNPSURWADE\DA in 15000ms
  
     at ConnectionError (..\SQL\Sample\sample\node_modules\tedious\lib\errors.js:13:12)  
     at Connection.connectTimeout (..\SQL\Sample\sample\node_modules\tedious\lib\connection.js:1195:54)  
     at Timeout._onTimeout (..\SQL\Sample\sample\node_modules\tedious\lib\connection.js:1157:12)  
     at listOnTimeout (internal/timers.js:549:17)  
     at processTimers (internal/timers.js:492:7) {  
        message: 'Failed to connect to servername\instantname in 15000ms',
        code: 'ETIMEOUT'
      },
      name: 'ConnectionError'
    }
  
  ConnectionError: Connection is closed.
  
  at Request._query (..\SQL\Sample\sample\node_modules\mssql\lib\base\request.js:462:37)  
  at Request._query (..\SQL\Sample\sample\node_modules\mssql\lib\tedious\request.js:346:11)  
  at Request.query (..\SQL\Sample\sample\node_modules\mssql\lib\base\request.js:398:12)  
  at Immediate.&lt;anonymous(..\SQL\Sample\sample\index.js:43:12)      
  at processImmediate  (internal/timers.js:458:21) {
     code: 'ECONNCLOSED',  
     name: 'ConnectionError'  
  }
  </code></pre>