简体   繁体   中英

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)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM