Could not open connection to sql server

I run this on the command line:

sqlcmd -s .\SQLexpress 

and the output I get:

HRsult 0x2, Level 16, State 1
Named Pipes Provider: Failed to open a connection to SQL Server [2]. Sqlcmd: error: Microsoft SQL Server 10.0 native client: connected to the network or an error occurred while establishing a connection to SQL Server, the server was not found or is unavailable. Verify that the instance name is correct and I am configured with SQL Server for a remote connection. For more information, see SQL Server Books Online. Sqlcmd: Error: Microsoft SQL Server Native Client 10.0: Login timed out.

when i run this:

 c:\Program Files (x86)\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Binn\sqlservr.exe" -sSQLEXPRESS 

i get: server error 17058 severity 16, state 1, failed to open error log file

however this works:

 osql -S .\SQLExpress -E 
+4
source share
2 answers

Go to the Start menu → Run, enter "C: \ Windows \ System32 \ mmc.exe / 32" C: \ Windows \ system32 \ SQLServerManager.msc ", then go to the configuration of your own client, client protocols and make sure that shared memory, tcp / ip and named pipes.

+3
source

This works for me.

1) SQLServer Services / SQL Server PropertieS: logging in as a built-in account, local system

2) Check if all protocols are enabled for SQLEXPRESS shared memory, named pipes and TCP / IP

3) SQL Native Client 11.0 Configuration: client protocols: shared memory, TCP / IP and named pipes - all ENABLED

4) Added system environment System> System destination> Environment settings> New Variable name: SQLCMDSERVER
Variable Value: \ SQLEXPRESS

Rob

0
source

Source: https://habr.com/ru/post/1302759/


All Articles