I have a Microsoft SQL Server, running in a Window Server 2012 R2 Standard. The configuration for this SQL Instance is: Servername: IP\SQLEXPRESS( IP here is the IP address of the Window Server) with SQL authentication username and password.
I would like to connect to this remote database from my local machine, so I installed sqlcmd on my local machine Win 7, and tried the syntax to connect to this remote server: sqlcmd -S IP\SQLEXPRESS -U username -P password, but then I got some error messages:
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : SQL Server
Network Inte rfaces: Error Locating Server/Instance Specified
[xFFFFFFFF]. .
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login timeout
expired.
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : A
network-related or in stance-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 i f SQL Server is
configured to allow remote connections. For more information see SQL
Server Books Online..
I searched some solutions in the Internet and did some configurations for the SQL Server, such as: enabled remote connection in SQL Server, activate TCP/IP Protocol, open incoming TCP Port 1433 by defining new rule in Windows Firewall of remote server, open outgoing TCP Port 1433 in my local Win 7 machine. But it seems there changes are not work in my case. Can anyone give me some hints here to fix this remote connecting problem?
Thank you in advance!
try use only sqlcmd -S IP
not IP\SQLEXPRESS
Related
I created an Amazon RDS database in SQL Server, created a custom security group with inbound rule type SQL Server protocal TCP Port "XXXX" Source "My PC's IP Address/32", allowed port "XXXX" over my firewall via "sudo ufw allow from any to any port "XXXX" proto tcp", successfully installed SQL Server on ubuntu via this tutorial: https://computingforgeeks.com/how-to-install-ms-sql-on-ubuntu/, and set 'public-accessibility' to 'no' in my AWS Database.
However, when I try to log in to my AWS Database from the command line via:
sqlcmd -S databasename.code.us-east-#.rds.amazonaws.com,XXXX -U username -P password -d DatabaseName
I get the error:
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x102.
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..
I spelled everything correctly. What am I doing wrong?
Can you please check your network ACL's of your VPC and also make sure you have ephemeral ports allowed on your VPC ACL's.
https://docs.aws.amazon.com/vpc/latest/userguide/vpc-network-acls.html#nacl-ephemeral-ports
I have a series of SQL Server instances that I need to connect to from inside a docker container using SQLCMD. These target SQL Server instances frustratingly have different versions with some on Windows Server 2012 and some on Windows Server 2003. When I try to connect to the Windows Server 2012 instances and execute sql commands using a command such as sqlcmd -S IP_Address,Port_No -U username -P password -i input_file.sql, it works perfectly. When I try the same for the Windows Server 2003 instances, I get the following error:
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2AF9.
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..
Is this just a situation where the connection syntax changes for Windows Server 2003? I have tried many different tweaks to the connection string but each returns the same message? Is SQLCMD even supported for Windows Server 2003? I would really appreciate any suggestions. Thank you.
I'm new to WSL, and running Ubuntu. I have a local instance of SQL Server 2017 installed in Windows, and want to connect to it from WSL. I have remote connections enabled, however, I can't seem to get connected from ubuntu locally.
I installed the db tools for ubuntu, and I'm using sqlcmd:
sqlcmd -S localhost -U sa -P <my password>
This keeps failing. How do I format/configure this to allow SQL Server in Windows to be available to Ubuntu?
Thanks!
EDIT
I'm using the default instance of SQL Server
Here's the error I'm getting
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2749.
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..
Pinging localhost:
$ ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=128 time=0.248 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=128 time=0.497 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=128 time=0.517 ms
Launch SQL Server Configuration Manager
Click on SQL Server Network Configuration
Right click on TCP/IP and click "Enable"
Go to your Services and Restart SQL Server
The solution provided by TheTFo for me did not fully work. I had to take it a step further by ensuring that the appropriate IP Address was enabled as well. Refer to Step 6 of this resource for instructions on how to do so.
Evening all,
We have been tasked to connect to our named server instance using SQLCMD below:
- Use SQLCMD to test connecting to the (named instance) TCP/IP listener
on TCP port 1433. Use the 127.0.0.1 loopback address to simulate the
network.
I have tried just about every method of connecting I can think of including the following basic scripts:
sqlcmd -S tcp:MyComputerName,1433
sqlcmd -S tcp:127.0.0.1,1433
sqlcmd.exe -S tcp:MyComputerName,1433 -Q "select getdate()"
This is the error I continually get:
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : Login timeout expired.
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0: A network-related or instance-specific error has occured 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.
I went through all the troubleshooting methods to ensure my Firewall accepts port 1433. I ensured Remote Connections could be accepted using the SQL Server Management Tool. TCP/IP protocol is enabled under all three areas of the Network Configuration Tool. The ports are 1433 in each protocol.
I am utterly confused.
I will say that there is one script I do get a positive connection via tcp and that is the following:
sqlcmd -S tcp:MyComputerName\SQLSERVERNAME
I end up with 1> to let me know the connection was good.
After researching this for quite some time I have turned to posting as I have been unable to troubleshoot a solution.
Thoughts?
edit
Just got this error for the first time:
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0: TCP Provider: No connection could be made because the target machine actively refused it.
I just ran into this problem too, right after a bran new installation of SQL-Server 2008r2 Developer on a Windows 10.
As Tim3890 pointed out, The issue was just that TCP/IP was not enable for the local SQL server.
see: https://dba.stackexchange.com/questions/62165/i-cant-connect-to-my-servers-sql-database-via-an-ip-address
I am having trouble connection to a local instance of Microsoft SQL Server 2012, this is what i have tried so far:
SQL Server Configuration Manager
Enable TCP/IP
Enable Named Pipes
Enable Shared Memory
The SQL Server, SQL Server Browser and SQL Server Agent services are all running.
I have verified that there is a SQL Server instance with: sqlcmd.exe -L this command gives me the following:
Servers:
(local)
MON-W530
SQLCMD
sqlcmd.exe -S MON-W530\MSSQLSERVER -E Gives the following output:
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : SQL Server Network Interfaces: Connection string is not valid [87]. .
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : Login timeout expired.
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : 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..
OSQL
OSQL.EXE -S MON-W530\MSSQLSERVER -E Gives the following output (Identical to sqlcmd.exe above)
[SQL Server Native Client 11.0]SQL Server Network Interfaces: Connection string is not valid [87].
[SQL Server Native Client 11.0]Login timeout expired
[SQL Server Native Client 11.0]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.
Its a fresh installation of Microsoft SQL Server 2012 Developer Edition, any help is appriciated.
Edit
Using SQL Server Management Studio 2012, i don't have the option to specify username and password for Windows Authentication, so i guess its not enabled, any clues on enabling Windows Auth is also appriciated.