title: Connecting NodeJS Express to MS SQL Server
body: <p>I'm a NodeJS newbie and I am building an application that talks to an MSSQL (SQL Server 2008 R2) Database. For this, I tried using <a href="http://docs.sequelizejs.com/en/latest/docs/getting-started/" rel="nofollow">Sequelize</a>, an ORM library that claims to do so.<br>
  While I have been successful in making it work with MySQL, SQL Server connection is just not working. I connected to a local database on both the occasions. Here's what I tried (as given in the docs):</p>
  
  <p>[Part 1: Establish Connection]</p>
  
  <pre><code>... Express Code ...
  var Sequelize = require('sequelize');
  
  var sequelize = new Sequelize('NewDB', '', '', {
    host: '(localdb)\v11.0',
    dialect: 'mssql',
  
    pool: {
      max: 5,
      min: 0,
      idle: 10000
    }
  });
  </code></pre>
  
  <p>[Part 2: Testing]</p>
  
  <pre><code>var User = sequelize.define('user', {
    firstName: {
      type: Sequelize.STRING,
      field: 'first_name' // Will result in an attribute that is firstName when user facing but first_name in the database
    },
    lastName: {
      type: Sequelize.STRING
    }
  }, {
    freezeTableName: true // Model tableName will be the same as the model name
  });
  
  User.sync({force: true}).then(function () {
    // Table created
    return User.create({
      firstName: 'John',
      lastName: 'Hancock'
    });
  });
  
  ... Express Code ...
  </code></pre>
  
  <p>The database NewDB does exist on the server. Now, While using SQL Server Express, the same credentials work. But not here. The error that I see is:</p>
  
  <blockquote>
    <p>Unhandled rejection SequelizeConnectionError: Failed to connect to (localdb)\v11.0:1433 = getaddrinfo ENOTFOUND (localdb)\v11.0</p>
  </blockquote>
  
  <p>So, here's the question. What credentials do I put, so that it works? And if it doesn't what would be alternate library to establish a Database connection? I'll prefer an ORM, but it's not that important a thing (anything works as long as I can connect to the DB).</p>