I need to access a SQL Server database which is installed on one machine and I want to access it from another machine. I have tried below options and nothing work
I have enabled TCP\IP with IPALL as 1433 in SQL Server Configuration manager
SQL Server and SQL Server Browser services are running, restarted after modified the configuration
Added SQL Server and TCP port to Windows firewall (allowed apps) as domain and public
Used
sqlcmd -S servername,portname -U username -P password -d database
What am I missing? On my local machine, it is working
Related
We cannot access from a client computer (Client) to a SQL Server computer (Server) on network A but successfully on another B. The Server computer has SQL Server 2019 installed, the Client computer has SQL Native Client 11.0 installed. We can connect from this client to the server in on network A either using sqlcmd, udl interface, or Telnet. But on a different network B, we cannot connect from the same Client to the same Server! What network configuration can avoid a SQL Server connection?
Server Parameters:
1. We defined firewall rules to allow inbound connection on ports 1433 for TCP and 1434 for UDP. We verified that that is the case on the Server by using "netstat -aon". We disabled the Norton Smart Firewall.
2. We have set this rule to apply to all profiles: Domain, Public, Private.
3. We ensured that all protocols for SQLEXPRESS are allowed and enabld in the SQL Server Configuration Manager, specifically TCP/IP.
4. We have enabled SQL Server Browser.
5. We have restarted all services multiple times after our configuration changes. We have even restarted the machine.
6. We made sure that the Server is accessible remotely and using SQL Server Authentication.
7. We reset both the modem and the router for both Networks before testing.
8. We confirmed both the Computer and the SQL Instance names in the SMSS logins and logs.
Tests we did on Network A:
1. We can ping the Client from the Server, the Server from the Client both with IP addresses and computer names (On Server: "ping -a ClientIP/ComputerName", On Client: "ping -a ServerIP/ComputerName". Both results with "Reply...").
2. We can access the database in the Server using SSMS both with Windows Authentication and SQL Server Authentication.
3. We cannot access to Server from the Client by Windows Authentication either by using "sqlcmd -S Server\sqlexpress -E".
4. We cannot access to Server from the Client by SQL Server Authentication by using "sqlcmd -U User -P Password -S Server\SQLExpress".
On the other hand, when these computers are in Network B, without changing anything we can connect to Server from the Client.
Here are the error messages we get:
sqlcmd -U User -P Password -S Server\SQLExpress
By default named instances use dynamic ports, which you're not allowing through the firewall.
The best solution is probably to simply configure the SQL Server instance to listen on the fixed port 1433, then you don't need to use an Instance Name or explicit port to connect.
To do this us SQL Server Configuration Manager to configure the instance to listen on port 1433 on all IPs. It should look like this:
With Dynamic Ports blank, and 1433 in the TCP IP port.
Then restart the SQL Server instance and in the SQL Server Logs you should see a message like
Server is listening on [ 'any' <ipv4> 1433].
Then try to connect like
sqlcmd -U User -P Password -S Server
And you can test with Powershell
PS C:\> test-netconnection Server -port 1433
If you do this you won't need the SQL Browser Service or the firewall rule for port 1434.
We have Azure SQL database (PAS) and planning to disable public deny access,so that we can't access the database from out side the virtual network. In order to access the database we created jumpserver (linux machine).
Currently we are executing the sql queries from Linux Jumphost, howerver Dev team wanted to access the database using DBeaver tool (onpremise env), so I am trying to enable SSH Tunnelling between Onpremise env and Azure database (Through Jump Server)
So i used following command to for port forwarding
ssh -A -L 8000:test.database.windows.net:1433 -i jumpprivatekey jumpuser#publicIp
Then opened DBeaver tool and provided SQL credentials . I am getting following exeception
The TCP/IP connection to the host 127.0.0.1, port 43753 has failed. Error: 'The driver received an unexpected pre-login response. Verify the connection properties and check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. This driver can be used only with SQL Server 2005 or later.'. ClientConnectionId:8147d2a0-a0d7-42e0-a4d2-948a4c1338bb
Can you please let me know is it possbile to Tunnel the Azure SQL database from onpremise environemnt without any point to site VPN. Or what is the best approach to accessing the Azure SQL database
I have a SQL Server version 12.0 instance installed on a Windows Server 2012R2 (SERVER/SQL), and a SQL Server Express version 11.0 instance installed on a windows 10 workstation (WIN10/SQLEXPRESS). Both are on the same domain. I am logged in as the domain admin and have full rights on both SQL instances.
On my WIN10 machine I am able to create a linked server from (WIN10/SQLEXPRESS) to (SERVER/SQL).
On my SERVER when I attempt to create a linked server from (SERVER/SQL) to (WIN10/SQLEXPRESS) I am told to ensure that the instance will allow for remote connections. I have gone through about 40 hours of troubleshooting this, ensuring that all firewalls, ports, security and agents and browsers are open.
Is there any reason I cannot link a SQL Server Express to another SQL Server, but can the other way around?
I would like to be able to call stored procedures from my main SQL Server but am not able to.
Please note, the purpose for the SQLEXPRESS on the WIN10 machine is due to the vendor requirements for the software I am using. Otherwise I would have the instance on my SERVER.
Almost certianly a network issue.
Using SQL Server Configuration Manager configure SQLEXPRESS to enable TCP/IP and listen on a fixed port, preferably 1433 if no other instance is on the server. Restart the instance.
Create a Windows Firewall rule enable inbound TCP/IP connections to the port.
Test network connectivity to the target port from the other server with powershell, eg:
PS C:\> test-netconnection WIN10 -Port 1433
Test SQL connectivity with SQLCMD or SSMS on the server to the WIN10 box.
Create the linked server.
Using SQL Server 2008 R2
I have 2 SQL Server instances on my PC, SQL1 and SQL2.
I have Windows XP installed in a VirtualBox. In XP, I have an application which can connect to SQL Servers.
When I try to connect to SQL1, everything is fine, but when I try to do that with SQL2 it errors out with
Could not open a connection to SQL Server
So I started checking the settings. I can connect to SQL2 using SQL Server Management Studio (on a local PC), so I checked that 'Allow remote connections to this server' was enabled. Also, in SQL Server configuration tool I enabled all protocols for this instance, just as it is for the SQL1. SQL Server browser is working.
Configuration of both instances seem to be identical. There is only one difference between SQL1 and SQL2 that I have noticed.
SQL1 version is 10.50.4000
SQL2 version is 10.50.1600
What can cause one of the instances to be unreachable through the network while the other one can be, and both settings are the same?
It could be firewall settings or network settings. For an instance to be reachable, configure at least the following.
TCP protocol enabled (SQL Server Configuration Manager)
Fixed TCP port (SQL Server Configuration Manager)
Enable SQL Server Browser Service
Open firewall for SQL Browser service (UDP port 1434) if you have a named instance.
Open TCP ports for SQL Server Instances.
See Configure the Windows Firewall to Allow SQL Server Access
A very mysterious problem coming up :P
I have a server configured with a static IP. I have installed SQL Server 2008 R2 with additional instance (ITAPP). Now When I use the IP to access the SQL Server following things happens:
Client Machine:
sqlcmd -S XXX.XXX.XXX.XXX -U sa -P mypass
Connected Successfully....
But when I use:
sqlcmd -S XXX.XXX.XXX.XXX\ITAPP -U sa -P mypass
HResult 0xFFFFFFFF, Level 16, State 1 SQL Network Interfaces: Error
Locating Server/Instance Specified [xFFFFFFFF].
Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred
while establishing a connection to the server.
When connecting to SQL Server 2005, this failure may be caused by the
fact that under the default settings SQL Server does not allow remote
connections..
Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.
Even on the same machine (where the SQL Server is installed) using SQL Server Management Studio. I have put off my firewall on both machines, even allow all the protocols for ITAPP (Shared Memory, Named Pipes, TCP/IP), also set Allow Remote connection to true.
One thing more when I use 127.0.0.1\SQLITRAX to connect on server machine it connects Immediately.
Please help me out from this mess :)
maybe it's because it's a named instance on a remote server.
Named instance don't use the SQL Server standard Tcp-port 1433, only the default (unnamed) instance use the 1433 port.
Any other "named" instance simply listen on another port.
So you should check in the SQL-Server configurator, on which TCP port is listening, and then tell the client to connect to this port.
Say that your named instance is listening to 12345 port, then the client should connect using the following command
sqlcmd -S XXX.XXX.XXX.XXX,12345 -U sa -P mypass
when you specify the TCP port, then you don't need the name of the instance.
In my understanding the name of the instance is a way for SQL Server services to find the TCP port that this named instance is listening on.
But for this to work your client need to be able to access those other services that resolve the instance name of SQL Server (maybe it's the Sql server Agent / SQL Server browser, but I'm not sure)
Update
Here is a screenshot that show where to set the TPC port for a SQL Server named instance.
so, on which TCP port is your named instance of SQL Server listening?
The SQL Server Browser service needs to be accessible to be able to connect to named instances.
See this article for more info on what it does and which ports to open on your firewall
This technet article provides a handy script to open up all required ports