title: 'Login failed for user' error when using SQL Server, but not when using tedious
body: <p>I'm trying to connect to a SQL Server Express database setup on a Windows 10 machine in network from a macbook running the following code. I can connect using <code>tedious</code>, but not using <code>mssql</code>. It's as if the username or password is wrong. The reason I want to get <code>mssql</code> working is for the pooling and because it appears to have more support... otherwise I would just use <code>tedious</code>. The code is creating both connections and the output shows tedious connecting but <code>mssql</code> fails.</p>
  
  <pre><code>const express = require('express');
  const sql = require('mssql');
  const bodyParser = require('body-parser');
  const app = express();
  
  var Connection = require('tedious').Connection;
  
  // Body Parser Middleware
  app.use(bodyParser.json());
  
  // CORS Middleware
  app.use(function(req, res, next) {
    res.header(&quot;Access-Control-Allow-Origin&quot;, &quot;*&quot;);
    res.header(&quot;Access-Control-Allow-Headers&quot;, &quot;Origin, X-Requested-With, Content-Type, Accept&quot;);
    next();
  });
  
  // define listineng port
  const PORT = 5006;
  
  // define tedious config
  var config = {
              server: &quot;JAMBER-VR1.local&quot;,
              userName: &quot;testuser&quot;,
              password: &quot;testuserpass&quot;,
              database: &quot;SQLEXPRESS&quot;,
              options: {
                encrypt: false
              }
       };
  
  var connection = new Connection (config);
  
  connection.on('connect', function(err){
  
      if(err!=null){
        console.log(err);
           console.log(&quot;not connected - tedious&quot;);
      }
      else{
            console.log(&quot;Connected - tedious&quot;)
            connection.close();
      };
  });
  
  
  // Define SQL config
  
  const dbConfig = {
    user: 'testuser',
    password: 'testuserpass',
    server: 'JAMBER-VR1.local',
    database: 'SQLEXPRESS',
    // port: 1433,
    // logging: true,
    options: {encrypt: false},
    pool: {
      max: 100,
      min: 0,
      idleTimeoutMillis: 30000
    }
  }
  
  const executeQuery = async () =&gt; {
    try {
      let pool = await sql.connect(dbConfig);
      console.log(&quot;pool connected - mssql&quot;);
      let result = await pool.request()
        .input('input_parameter', sql.Int, value)
        .query('select * from donor')
  
      console.log(&quot;Result: &quot;, result);
    } catch (err) {
      console.log(&quot;Error: &quot;, err);
    }
  }
  
  executeQuery();
  </code></pre>
  <p>I'm getting the following error.</p>
  <blockquote>
  <p>[nodemon] starting <code>node index.js</code><br />
  Running on port 5006<br />
  Connected - tedious<br />
  Error:  { ConnectionError: Login failed for user 'testuser'.</p>
  <p>at Connection.tedious.once.err (/Users/jordanszymczyk/Code/TRTL/server_sql /node_modules/mssql/lib/tedious.js:237:17)<br />
  at Object.onceWrapper (events.js:273:13)<br />
  at Connection.emit (events.js:182:13)
  at Connection.processLogin7Response (/Users/jordanszymczyk/Code/TRTL/server_sql/node_modules/tedious/lib/connection.js:1292:16)
  at Connection.message (/Users/jordanszymczyk/Code/TRTL/server_sql/node_modules/tedious/lib/connection.js:1805:14)
  at Connection.dispatchEvent (/Users/jordanszymczyk/Code/TRTL/server_sql/node_modules/tedious/lib/connection.js:1004:38)
  at MessageIO. (/Users/jordanszymczyk/Code/TRTL/server_sql/node_modules/tedious/lib/connection.js:884:18)
  at MessageIO.emit (events.js:182:13)
  at ReadablePacketStream. (/Users/jordanszymczyk/Code/TRTL/server_sql/node_modules/tedious/lib/message-io.js:104:16)
  at ReadablePacketStream.emit (events.js:182:13)
  code: 'ELOGIN',
  originalError:
  { ConnectionError: Login failed for user 'testuser'.
  at ConnectionError (/Users/jordanszymczyk/Code/TRTL/server_sql/node_modules/tedious/lib/errors.js:12:12)
  at Parser. (/Users/jordanszymczyk/Code/TRTL/server_sql/node_modules/tedious/lib/connection.js:628:33)
  at Parser.emit (events.js:182:13)
  at Parser. (/Users/jordanszymczyk/Code/TRTL/server_sql/node_modules/tedious/lib/token/token-stream-parser.js:54:15)
  at Parser.emit (events.js:182:13)
  at addChunk (/Users/jordanszymczyk/Code/TRTL/server_sql/node_modules/readable-stream/lib/_stream_readable.js:291:12)
  at readableAddChunk (/Users/jordanszymczyk/Code/TRTL/server_sql/node_modules/readable-stream/lib/_stream_readable.js:278:11)
  at Parser.Readable.push (/Users/jordanszymczyk/Code/TRTL/server_sql/node_modules/readable-stream/lib/_stream_readable.js:245:10)
  at Parser.Transform.push (/Users/jordanszymczyk/Code/TRTL/server_sql/node_modules/readable-stream/lib/_stream_transform.js:148:32)
  at doneParsing (/Users/jordanszymczyk/Code/TRTL/server_sql/node_modules/tedious/lib/token/stream-parser.js:110:18)
  message: 'Login failed for user 'testuser'.',
  code: 'ELOGIN' },
  name: 'ConnectionError' }</p>
  </blockquote>
  <p>You can see the console.log(&quot;Connected - tedious&quot;) prints, then the mssql error follows immediately.
  I've also tried using the local IP with the same results.
  Testing through sqlcmd works.</p>