I am using Sequelize to connect to a SQLServer database. I used this config for Sequelize:
module.exports = {
database: 'dbname',
username: 'sa',
password: 'password',
options: {
dialect: 'mssql',
host: 'host address',
port: 1433,
dialectOptions: {
instanceName: 'instancename'
}
}
}
but i got this error:
ConnectionError: Login failed for user 'sa'.
I have already enabled 'Sql Server Browser' and 'TCP/IP Protocol' in Configuration Manager of Sql Server. My instance name is default 'MSSQLSERVER'.
I have already installed tedious.
Stack trace from Node.js:
{ SequelizeConnectionError: Login failed for user 'sa'.
at Connection.<anonymous> (P:\ChatRoom\node_modules\sequelize\lib\dialects\mssql\connection-manager.js:109:16)
at emitOne (events.js:96:13)
at Connection.emit (events.js:188:7)
at Connection.processLogin7Response (P:\ChatRoom\node_modules\tedious\lib\connection.js:672:16)
at Connection.message (P:\ChatRoom\node_modules\tedious\lib\connection.js:1082:21)
at Connection.dispatchEvent (P:\ChatRoom\node_modules\tedious\lib\connection.js:519:45)
at MessageIO.<anonymous> (P:\ChatRoom\node_modules\tedious\lib\connection.js:439:23)
at emitNone (events.js:86:13)
at MessageIO.emit (events.js:185:7)
at ReadablePacketStream.<anonymous> (P:\ChatRoom\node_modules\tedious\lib\message-io.js:92:15)
at emitOne (events.js:96:13)
at ReadablePacketStream.emit (events.js:188:7)
at readableAddChunk (P:\ChatRoom\node_modules\tedious\node_modules\readable-stream\lib\_stream_readable.js:213:18)
at ReadablePacketStream.Readable.push (P:\ChatRoom\node_modules\tedious\node_modules\readable-stream\lib\_stream_readable.js:172:10)
at ReadablePacketStream.Transform.push (P:\ChatRoom\node_modules\tedious\node_modules\readable-stream\lib\_stream_transform.js:123:32)
at ReadablePacketStream._transform (P:\ChatRoom\node_modules\tedious\lib\message-io.js:57:16)
name: 'SequelizeConnectionError',
message: 'Login failed for user \'sa\'.',
parent:
{ ConnectionError: Login failed for user 'sa'.
at ConnectionError (P:\ChatRoom\node_modules\tedious\lib\errors.js:12:12)
at Parser.<anonymous> (P:\ChatRoom\node_modules\tedious\lib\connection.js:216:38)
at emitOne (events.js:96:13)
at Parser.emit (events.js:188:7)
at Parser.<anonymous> (P:\ChatRoom\node_modules\tedious\lib\token\token-stream-parser.js:42:15)
at emitOne (events.js:96:13)
at Parser.emit (events.js:188:7)
at readableAddChunk (P:\ChatRoom\node_modules\tedious\node_modules\readable-stream\lib\_stream_readable.js:213:18)
at Parser.Readable.push (P:\ChatRoom\node_modules\tedious\node_modules\readable-stream\lib\_stream_readable.js:172:10)
at Parser.Transform.push (P:\ChatRoom\node_modules\tedious\node_modules\readable-stream\lib\_stream_transform.js:123:32)
at doneParsing (P:\ChatRoom\node_modules\tedious\lib\token\stream-parser.js:87:17)
at P:\ChatRoom\node_modules\tedious\lib\token\infoerror-token-parser.js:46:5
at P:\ChatRoom\node_modules\tedious\lib\token\infoerror-token-parser.js:13:19
at P:\ChatRoom\node_modules\tedious\lib\token\stream-parser.js:224:9
at Parser.awaitData (P:\ChatRoom\node_modules\tedious\lib\token\stream-parser.js:121:9)
at Parser.readUInt32LE (P:\ChatRoom\node_modules\tedious\lib\token\stream-parser.js:221:12) message: 'Login failed for user \'sa\'.', code: 'ELOGIN' },
original:
{ ConnectionError: Login failed for user 'sa'.
at ConnectionError (P:\ChatRoom\node_modules\tedious\lib\errors.js:12:12)
at Parser.<anonymous> (P:\ChatRoom\node_modules\tedious\lib\connection.js:216:38)
at emitOne (events.js:96:13)
at Parser.emit (events.js:188:7)
at Parser.<anonymous> (P:\ChatRoom\node_modules\tedious\lib\token\token-stream-parser.js:42:15)
at emitOne (events.js:96:13)
at Parser.emit (events.js:188:7)
at readableAddChunk (P:\ChatRoom\node_modules\tedious\node_modules\readable-stream\lib\_stream_readable.js:213:18)
at Parser.Readable.push (P:\ChatRoom\node_modules\tedious\node_modules\readable-stream\lib\_stream_readable.js:172:10)
at Parser.Transform.push (P:\ChatRoom\node_modules\tedious\node_modules\readable-stream\lib\_stream_transform.js:123:32)
at doneParsing (P:\ChatRoom\node_modules\tedious\lib\token\stream-parser.js:87:17)
at P:\ChatRoom\node_modules\tedious\lib\token\infoerror-token-parser.js:46:5
at P:\ChatRoom\node_modules\tedious\lib\token\infoerror-token-parser.js:13:19
at P:\ChatRoom\node_modules\tedious\lib\token\stream-parser.js:224:9
at Parser.awaitData (P:\ChatRoom\node_modules\tedious\lib\token\stream-parser.js:121:9)
at Parser.readUInt32LE (P:\ChatRoom\node_modules\tedious\lib\token\stream-parser.js:221:12) message: 'Login failed for user \'sa\'.', code: 'ELOGIN' } }
The username and password of my database is completely tested and connected with, and 'Server authentication' is set to 'SQL Server and Windows Authentication mode'.
I really appreciate any advise or help to solve this.