SQL Server connection over ip and port on Windows 10 - sql-server

I have a SQL Server 2014 instance SQLExpress installed on Windows 10 Pro, when I open SQL Server Management Studio, I am able to query my database Banners and everything is OK.
But when I try to connect to this database using ip address and port (so I could access it from my laravel backend), it says connection time out.
I already specified a port (50000) for the SQL Server service port and added that port to the Windows Firewall inbound rules.
But still no luck.
I tried to check if the port 50000 is open using:
https://portchecker.co
but it says: CLOSED
Any ideas please?

It seems that the 50000 port in your PC is blocked by a naughty process, so I suggest you could check and try to kill it. Steps are as followed:
press win+R to open the cmd window;
input command: netstat -aon|findstr "50000";
if your 50000 port is really blocked by something, you will find one pid in
50000 port, and now call this pid xxx;
input command: taskkill /pid xxx -t -f, kill it!
then you can connect to your db normally.

Related

SQL Server Hosted on Lightsail Unavailable remotely

I have a SQL Server - Developer edition - hosted on an Ubuntu 20.04 Lightsail instance in AWS. I have a static IP configured, and I have my ports opened up on 1041 to allow traffic to the server. I am able to SSH into the server remotely, and I can see that the 1041 port is open - however, any time I try to connect to the server through SSMS, I'm unable to actually connect to it, with the error
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TC Provider, error: 0 - The wait operation timed out.) (Microsoft SQL Server, Error: 258)
I'm able to run commands using /opt/mssql-tools/bin/sqlcmd -S localhost,[myPort] -U [myUsr] -P [myPwd] -Q "[myQuery]", so I know the server is up and running, and responsive.
I've validated that the server is listening on the SQL Server port by calling netstat -tunlp, and seeing that the port is in the LISTEN state.
I've validated that I have no additional Firewall running, so the only thing that should be blocking is the Lightsail Networking. I decided to go for broke, and opened up the server to all TCP traffic - which still got me nowhere.
I've checked to see that remote connections are allowed (they are) - but I have a feeling this is where my issue lies. I read that the command to allow remote connections is EXEC sp_configure 'remote access', 1 ; - I ran this, and rebooted and still nothing. Then I found out that that command isn't necessarily related to allowing remote connections TO the server, and it instead allows remote connections FROM the server.
Is there any other options/tools that I'm missing that I can use to allow remote connections to the SQL Server?
Edit 1 - Updating ipaddress in config
On the advice of #AlwaysLearning, I updated my mssql.conf file to explicitly list 0.0.0.0 as the ipaddress of the sql server.
When I did this, I restarted the mssql server, and it now crashes constantly. I removed the 0.0.0.0 address, but it looks like that was able to force mssql to start up listening under 0.0.0.0?
However, it is still unable to connect remotely. I noticed that when I run tcpdump -nn -i any port 1041, I DO see connections to it, but I DON'T see my attempts from my external connection to it. It looks like I'm listening correctly now, but I don't actually get any traffic to the server?

Unable to connect to postgres server remotely(ubuntu 16.04)

I am pretty new to postgreSQL. I am running version 9.5 of it on my main machine. I am trying to establish a telnet connection from my virtual machine. Before doing that I have configured the postgresql.conf and pg_hba.conf files to accept connection from remote machine in the same network.
However when I start the postgresql service using:
service postgresql start
The process show the status:
active(exited)
and the telnet connection is also refused(when i run telnet x.x.x.x 5432). Also when i start the postgresql service using
systemctl start postgresql#9.5-main
the status is active(running) but the telnet connection is still refused. Can anyone tell me how to establish the telnet connection? I dont really know whats going on and I am new here so please dont mind if its a noob question

How to find SQL Server running port when you don't own the server?

In our enterprise I don't have access to MSSQL Server, so I can'r access the system tables.
What works for me is:
capture the network traffic Wireshark (run as Administrator, select Network Interface),while opening connection to server.
Find the ip address with ping
filter with ip.dst == x.x.x.x
The port is shown in the column info in the format src.port -> dst.port
If you have elevated rights to SQL but not the OS, you can query the log.
If you don't have access to the OS but can run queries, perhaps try:
USE master
GO
xp_readerrorlog 0, 1, N'Server is listening on'
GO
If you don't have elevated rights to SQL, from the client-side windows machine with an active connection, you could run a netstat command and see on which ports you are connected to the target. Filter on IP address of the host.
netstat -an | find "10.1.10.xxx"
You'll see that I have connections to the host on 3389 and 1433. Maybe this helps narrow it down.

SQL Server 2008 suddenly stopped connecting

This one is strange...
I have a server at home that's part of my home network (workgroup). It has SQL Server 2008 R2 SP1 running on it. I've been connecting to it from my (other) desktop regularly for months now and tonight all of a sudden I can't connect to it from my desktop. I can connect to it if I RDP onto the server and connect locally. I've checked the event logs on the server and nothing interesting appears.
Here's the (unhelpful) error returned by Management Studio from my desktop when trying to connect to the server:
Timeout expired. The timeout period elapsed prior to completion of
the operation or the server is not responding. (.Net SqlClient Data
Provider)
I'm kinda stumped by this really. I've tried connecting with sqlcmd - it tells me this:
Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : Unable to
complete login process due to delay in opening server connection.
Not really sure what that means. I've made sure SQL Server is configured to allow remote connections and have used netstat -a and seen that it's listening on port 1433 (for all IPs).
Anyone got any helpful ideas? I've rebooted the server too, but that didn't change anything.
EDIT/UPDATE: from my desktop I can ping the server by host name and I get something like this:
Reply from fe80::9077:4449:4b37:cad1%12: time<1ms
but if I try to ping it by it's IP address it times out. I wonder if that points to some kind of IPv4 vs. IPv6 issue?
Is the IP adress resolved from your desktop the actual ipadress of the server ?
Run a ipconfig /all from the server, and do a nslookup from your desktop to see if IP addresses are matching. I had cases when the DNS was messed up, and IP address resolution was wrong.

sql 2008 express connection problems

I've just installed a fresh copy of SQL 2008 Express. before I did anything I opened Management Studio and successfully connected using Window Authentication.
However I tried to run the following on the command line
"telnet localhost 1433" and got the error "Could not open connection to the host, on port 1433: Connect failed"
I checked netstat and there is nothing listening on port 1433.
Before I go any further, is there a problem with the install?
thanks,
Shane
did you check if the tcp/ip protocol is enabled? It's disabled by default if I remember correctly.
are you telling your SQL Server to listen on TCP/IP
http://blogs.msdn.com/sqlexpress/archive/2005/05/05/415084.aspx
The port number isn't guaranteed to be 1433.
In Sql Server Configuration Manager, make sure:
(1) SQL Server is running
(2) SQL Server Browser is running.
(3) In the Protocols for SQLEXPRESS that TCP/IP is on. You can check the port inside there.
Alternately get the port by finding the PID of sqlservr.exe in Task Manager and then typing:
netstat -ano | findstr PID
Prior to these steps I couldn't connect via 127.0.0.1 myself, now I can connect even from a remote machine on my LAN. (Note: for LAN access you'll need to add firewall exceptions for sqlservr.exe and sqlbrowser.exe)

Resources