I have a nodejs and express based project. I currently use sequelize to connect to a SQL Server instance. This works fine for external SQL Servers using SQL Server authentication. However, I am now trying to connect to a local SQL Server instance using Windows auth.
This is what my connection string looks like:
export var sequelize = new Sequelize({
dialect: 'mssql',
dialectModulePath: 'sequelize-msnodesqlv8',
dialectOptions: {
connectionString: 'Server=localhost\MSSQLSERVER01;Database=DB-demo; Integrated Security=SSPI;'
},
});
However, that is throwing the error:
Unhandled rejection SequelizeConnectionError: [Microsoft][SQL Server Native Client 11.0]Named Pipes Provider: Could not open a connection to SQL Server [53].
at Connection. (C:\Users\George\Source\Repos\Test-Proj\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 mssql.open (C:\Users\George\Source\Repos\Test-Proj\node_modules\sequelize-msnodesqlv8\lib\connection.js:107:9)
at Immediate. (C:\Users\George\Source\Repos\Test-Proj\node_modules\msnodesqlv8\lib\ConnectionWrapper.js:336:11)
at runCallback (timers.js:672:20)
at tryOnImmediate (timers.js:645:5)
at processImmediate [as _immediateCallback] (timers.js:617:5)
NB: I can connect fine to this with windows auth in ssms. see :
To summarise what's been discussed in the comments - SQL Server Browser is running, My SQL Server instance does have TCP/IP & Named Pipes enabled.
Here is the most recent error log:
2017-08-29 15:30:25.70 Server Microsoft SQL Server 2016 (SP1) (KB3182545) - 13.0.4001.0 (X64)
Oct 28 2016 18:17:30
Copyright (c) Microsoft Corporation
Developer Edition (64-bit) on Windows 10 Pro 6.3 <X64> (Build 15063: )
2017-08-29 15:30:25.71 Server UTC adjustment: 1:00
2017-08-29 15:30:25.71 Server (c) Microsoft Corporation.
2017-08-29 15:30:25.71 Server All rights reserved.
2017-08-29 15:30:25.71 Server Server process ID is 13168.
2017-08-29 15:30:25.71 Server System Manufacturer: 'Microsoft Corporation', System Model: 'Surface Pro 3'.
2017-08-29 15:30:25.71 Server Authentication mode is WINDOWS-ONLY.
2017-08-29 15:30:25.71 Server Logging SQL Server messages in file 'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER01\MSSQL\Log\ERRORLOG'.
2017-08-29 15:30:25.71 Server The service account is 'NT Service\MSSQL$MSSQLSERVER01'. This is an informational message; no user action is required.
2017-08-29 15:30:25.71 Server Registry startup parameters:
-d C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER01\MSSQL\DATA\master.mdf
-e C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER01\MSSQL\Log\ERRORLOG
-l C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER01\MSSQL\DATA\mastlog.ldf
2017-08-29 15:30:25.72 Server Command Line Startup Parameters:
-s "MSSQLSERVER01"
2017-08-29 15:30:25.72 Server SQL Server detected 1 sockets with 2 cores per socket and 4 logical processors per socket, 4 total logical processors; using 4 logical processors based on SQL Server licensing. This is an informational message; no user action is required.
2017-08-29 15:30:25.72 Server SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
2017-08-29 15:30:25.72 Server Detected 4001 MB of RAM. This is an informational message; no user action is required.
2017-08-29 15:30:25.72 Server Using conventional memory in the memory manager.
2017-08-29 15:30:25.85 Server Default collation: Latin1_General_CI_AS (us_english 1033)
2017-08-29 15:30:25.91 Server Buffer pool extension is already disabled. No action is necessary.
2017-08-29 15:30:25.94 Server InitializeExternalUserGroupSid failed. Implied authentication will be disabled.
2017-08-29 15:30:25.94 Server Implied authentication manager initialization failed. Implied authentication will be disabled.
2017-08-29 15:30:25.95 Server The maximum number of dedicated administrator connections for this instance is '1'
2017-08-29 15:30:25.95 Server This instance of SQL Server last reported using a process ID of 4764 at 29/08/2017 15:30:18 (local) 29/08/2017 14:30:18 (UTC). This is an informational message only; no user action is required.
2017-08-29 15:30:25.96 Server Node configuration: node 0: CPU mask: 0x000000000000000f:0 Active CPU mask: 0x000000000000000f:0. This message provides a description of the NUMA configuration for this computer. This is an informational message only. No user action is required.
2017-08-29 15:30:25.96 Server Using dynamic lock allocation. Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node. This is an informational message only. No user action is required.
2017-08-29 15:30:25.97 Server Database Instant File Initialization: enabled. For security and performance considerations see the topic 'Database Instant File Initialization' in SQL Server Books Online. This is an informational message only. No user action is required.
2017-08-29 15:30:26.00 Server Query Store settings initialized with enabled = 1,
2017-08-29 15:30:26.00 spid5s Starting up database 'master'.
2017-08-29 15:30:26.08 Server CLR version v4.0.30319 loaded.
2017-08-29 15:30:26.15 spid5s Resource governor reconfiguration succeeded.
2017-08-29 15:30:26.15 spid5s SQL Server Audit is starting the audits. This is an informational message. No user action is required.
2017-08-29 15:30:26.15 spid5s SQL Server Audit has started the audits. This is an informational message. No user action is required.
2017-08-29 15:30:26.20 spid5s SQL Trace ID 1 was started by login "sa".
2017-08-29 15:30:26.20 spid5s Server name is 'SURFACE\MSSQLSERVER01'. This is an informational message only. No user action is required.
2017-08-29 15:30:26.23 spid6s Starting up database 'mssqlsystemresource'.
2017-08-29 15:30:26.23 spid14s Starting up database 'msdb'.
2017-08-29 15:30:26.23 spid15s Starting up database 'Prod-Sense'.
2017-08-29 15:30:26.24 spid6s The resource database build version is 13.00.4001. This is an informational message only. No user action is required.
2017-08-29 15:30:26.32 Server Common language runtime (CLR) functionality initialized using CLR version v4.0.30319 from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\.
2017-08-29 15:30:26.33 spid6s Starting up database 'model'.
2017-08-29 15:30:26.37 spid6s Polybase feature disabled.
2017-08-29 15:30:26.37 spid6s Clearing tempdb database.
2017-08-29 15:30:26.58 spid10s A self-generated certificate was successfully loaded for encryption.
2017-08-29 15:30:26.59 spid6s Starting up database 'tempdb'.
2017-08-29 15:30:26.59 spid10s Server is listening on [ 'any' <ipv6> 50465].
2017-08-29 15:30:26.59 spid10s Server is listening on [ 'any' <ipv4> 50465].
2017-08-29 15:30:26.59 spid10s Server local connection provider is ready to accept connection on [ \\.\pipe\SQLLocal\MSSQLSERVER01 ].
2017-08-29 15:30:26.59 spid10s Server named pipe provider is ready to accept connection on [ \\.\pipe\MSSQL$MSSQLSERVER01\sql\query ].
2017-08-29 15:30:26.59 Server Server is listening on [ ::1 <ipv6> 61076].
2017-08-29 15:30:26.59 Server Server is listening on [ 127.0.0.1 <ipv4> 61076].
2017-08-29 15:30:26.59 Server Dedicated admin connection support was established for listening locally on port 61076.
2017-08-29 15:30:26.60 spid10s SQL Server is now ready for client connections. This is an informational message; no user action is required.
2017-08-29 15:30:26.60 Server SQL Server is attempting to register a Service Principal Name (SPN) for the SQL Server service. Kerberos authentication will not be possible until a SPN is registered for the SQL Server service. This is an informational message. No user action is required.
2017-08-29 15:30:26.60 Server The SQL Server Network Interface library could not register the Service Principal Name (SPN) [ MSSQLSvc/Surface:MSSQLSERVER01 ] for the SQL Server service. Windows return code: 0xffffffff, state: 63. Failure to register a SPN might cause integrated authentication to use NTLM instead of Kerberos. This is an informational message. Further action is only required if Kerberos authentication is required by authentication policies and if the SPN has not been manually registered.
2017-08-29 15:30:26.60 Server The SQL Server Network Interface library could not register the Service Principal Name (SPN) [ MSSQLSvc/Surface:50465 ] for the SQL Server service. Windows return code: 0xffffffff, state: 63. Failure to register a SPN might cause integrated authentication to use NTLM instead of Kerberos. This is an informational message. Further action is only required if Kerberos authentication is required by authentication policies and if the SPN has not been manually registered.
2017-08-29 15:30:26.77 spid6s The tempdb database has 4 data file(s).
2017-08-29 15:30:26.77 spid16s The Service Broker endpoint is in disabled or stopped state.
2017-08-29 15:30:26.77 spid16s The Database Mirroring endpoint is in disabled or stopped state.
2017-08-29 15:30:26.78 spid16s Service Broker manager has started.
2017-08-29 15:30:26.78 spid5s Recovery is complete. This is an informational message only. No user action is required.
2017-08-29 15:30:27.01 Server Software Usage Metrics is disabled.
2017-08-29 15:31:54.18 spid51 Attempting to load library 'xpsqlbot.dll' into memory. This is an informational message only. No user action is required.
2017-08-29 15:31:54.18 spid51 Using 'xpsqlbot.dll' version '2015.130.1601' to execute extended stored procedure 'xp_qv'. This is an informational message only; no user action is required.
2017-08-29 15:31:58.99 spid53 Attempting to load library 'xpstar.dll' into memory. This is an informational message only. No user action is required.
2017-08-29 15:31:59.01 spid53 Using 'xpstar.dll' version '2015.130.1601' to execute extended stored procedure 'xp_regread'. This is an informational message only; no user action is required.
I tried for 4 times in chat but now I post it here.
Your server is configured for Windows Authentication
only, it's written in error log.
To change it to mixed mode
right click your server in SSMS, go to Properties, Security tab and change the mode to mixed as shown in my picture.
Then restart your server
User contributions licensed under CC BY-SA 3.0