title: SQL Server Error "[ConnectionError: Login failed for user '****'.] "while connecting SQL Server with Nodejs using MSSQL
body: <p>I am getting below error</p>
  
  <pre><code>      [ConnectionError: Login failed for user '****'.]
               name: 'ConnectionError',
               message: 'Login failed for user \'****\'.',
               code: 'ELOGIN' } "
  </code></pre>
  
  <p>Below is the code that i used to connect sql server with nodejs using mssql package.</p>
  
  <pre><code>var sql = require('mssql');
  
  var config = {
          server: "localhost\\",// You can use 'localhost\\instance' to connect to named instance 
          database: "***",
          user: "***",
          password: "",
          port: 1433
      };
  
  function getdata() {
      var conn = new sql.Connection(config);
      var req = new sql.Request(conn);
  
      conn.connect(function (err) {
          If (err) {
              console.log(err);
              return;
          }
          req.query("select * From" ,function (err,recordset)  {
          If (err) {
              console.log(err);
              return;
          }
          else {
              console.log(recordset);
  
          }
          conn.close();
  
  
          enter code here
          });
  
      });
  
      }
  
      getdata();
  </code></pre>
  
  <p>Below is the message displayed when i add console to "conn" ,Kindly let me know if i have missed anything.</p>
  
  <pre><code>config:
        { server: '',
          database: '',
          user: '',
          password: '',
          port: 1433,
          driver: 'tedious',
          options: {},
          stream: false,
          parseJSON: false },
       driver:
        { Connection:
           { [Function: TediousConnection]
             EventEmitter: [Object],
             usingDomains: false,
             defaultMaxListeners: 10,
             init: [Function],
             listenerCount: [Function],
             __super__: [Object] },
          Transaction:
           { [Function: TediousTransaction]
             EventEmitter: [Object],
             usingDomains: false,
             defaultMaxListeners: 10,
             init: [Function],
             listenerCount: [Function],
             __super__: [Object] },
          Request:
           { [Function: TediousRequest]
             EventEmitter: [Object],
             usingDomains: false,
             defaultMaxListeners: 10,
             init: [Function],
             listenerCount: [Function],
             __super__: [Object] },
          fix: [Function] } }
      started
  </code></pre>