title: My Node.js local application won't connect to Azure SQL DB
body: <p>I am developing a Node.js-Express-EJS web application, with Azure SQL DB (cloud version of MS SQL Server).</p>
  
  <p>I try to test my connection first on the remote Azure SQL DB, using SQL Server Management Studio. First, I set my machine's IP to be allowed in Azure SQL DB firewall rules. Then I was able to get into the database, create and populate table, and query using the Management Studio.</p>
  
  <p>Now, I have the Node.js app locally first. However, it seems it can't connect to the remote Azure SQL DB using same credentials.</p>
  
  <p>First, I use the tutorial in node-mssql:</p>
  
  <pre><code>/* Using node-mssql */
  var sql = require('mssql');
  
  router.get('/test/mssql', function(req, res, next) {
  
      console.log('Testing node-mssql')
  
      sql.connect("mssql://&lt;username&gt;:&lt;password&gt;@&lt;server&gt;.database.windows.net/&lt;db&gt;")
          .then(function() {
  
              new sql.Request()
                  .query('SELECT * FROM mytable')
                  .then(function(recordset) {
                      console.dir(recordset);
                  }).catch(function(err) {
                      console.log(err);
                  });
  
  
          }).catch(function(err) {
              console.log(err);
          });
  });
  </code></pre>
  
  <p>I was only able to get from the console </p>
  
  <pre><code>'Testing node-mssql'
  GET /contact/test/mssql  - - ms - -
  </code></pre>
  
  <p>But no response, it seems its waiting forever, it didn't even throw error.</p>
  
  <p>Same thing happens when I use Sequelize.js</p>
  
  <pre><code>/* Using Sequelize.js */
  var Sequelize = require('sequelize');
  
  var sequelize = new Sequelize('&lt;db&gt;', '&lt;username&gt;', '&lt;password&gt;', {
    host: '&lt;mydb&gt;.database.windows.net',
    dialect: 'mssql',
  
    pool: {
      max: 5,
      min: 0,
      idle: 10000
    },
  
  });
  
  router.get('/test/sequelize', function(req, res, next) {
  
      console.log('Testing sequelize');
  
      sequelize.authenticate()
          .then(function(err) {
              console.log('Connection has been established successfully');
          })
          .catch(function(err) {
              console.log('Unable to connect to the database:', err);
          });
  });
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>Testing sequelize
  GET /test/sequelize - - ms - -
  </code></pre>
  
  <p>Here are the versions that I am using:</p>
  
  <pre><code>Node.js - 4.6.0
  express - 4.14.0
  mssql - 3.3.0
  sequelize - 3.30.2
  tedious - 1.14.0
  </code></pre>
  
  <p>(I wonder if this has to do with me connected on WiFi? But impossible, bec. Management Studio works fine right?)</p>