FanaS
FanaS

Reputation: 31

SQLCMD utility : connection to second instance does not work

I have only SQLCMD utility installed locally and want connect to MSSQL instance, but it seems the tool cannot parse the instance name example:

sqlcmd -S SERVER\INSTANCE -U sa -P password

However, I can use this command from the machine where SQL Server is already installed.

Error message: Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF]..
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..

Upvotes: 2

Views: 731

Answers (2)

Alfabravo
Alfabravo

Reputation: 7569

Please make sure you enable TCP/IP Protocol. This is different from allowing network connections in the server properties.

This is a MSSQL 2012 example, but I have it tested on MSSQL 2017 Developer (full) and still works the same (and also, fails just the same when disabled)

enter image description here

Upvotes: 0

hugovicfortman
hugovicfortman

Reputation: 201

To use SQLCMD to connect to a remote server instance use the full URI of your server over the network like so;

sqlcmd -S FULLSERVERURI\INSTANCE -U sa -P password

for example, if you had your server at 'someplace.com', your connection would be

sqlcmd -S someplace.com\INSTANCE -U sa -P password

The machine/server would need to have port 1433 open. Consider your network security options.

Upvotes: 0

Related Questions