user2004403
user2004403

Reputation: 233

Connect to a SQL Server using NodeJS

I'm having a project which I need the server to have db. I chose Sql Server 2012 (because I used it). Now the sql configured with a Windows authentication and I unable to connect it (maybe it's because the config string is not good).

Should I use windows authentication or sql connection? I use require ('mssql') and my config is like this:

var config = {
  user: 'MyName',
  password: '123',
  server: 'localhost',
  database: 'MyProj',
  options: {
    instanceName: 'SQLEXPRESS'
  }
};

error message:

{ [ConnectionError: Failed to get response from SQL Server Browser on localhost] name: 'ConnectionError', message: 'Failed to get response from SQL Server Browser on localhost', code: 'EINSTLOOKUP' }

What did I do wrong? (I know something wrong because it doesn't working)

Upvotes: 0

Views: 2153

Answers (1)

Sequenzia
Sequenzia

Reputation: 2381

I normally always make sure all my MS SQL Servers are setup in Mixed Mode. Then you can use the actual username and password in your connection string

Upvotes: 1

Related Questions