sql 2008 express connection problems - database

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)

Related

Correct Firewall Exception for Named Pipes (SQL Server)

I am trying to debug aspx.net and c# code. An sql connection to a remote SQL server default instance should be opened.
The connection works fine if the windows firewall on the sql server host is down.
If the windows firewall is up I get an error:
named Pipes Provider Error 40 cannot open connection to Sql server instance
The dev machine is windows 10 with visual studio.
The machine with the ms sql server instance is a vm with windows 2012 with sql server 2012.
In that machine I get an error in the windows security events claiming that the user name or password is incorrect. This error is a bit strange since the user name and password must be correct (otherwise it would not work if the firewall was down)
I have already checked the sql server configuration manager TCP/IP and named pipes are enabled.
In the firewall I already set an exception allowing a TCP connection to port 1433.
In the sql server configuration manager - SQL Server network configuration - TCP/IP the listed port is 1433. So I cannot find my mistake in the firewall config. What am I missing?
Found the solution:
The firewall rule to allow port 1433 had to be extended. Even though switching off the private firewall made the access work did not mean that the firewall rule allowing access only in the private profile would be enough. Making the port 1433 available for all profiles (private, public, domain) solved the problem.
Thanks to Christian. Even though port 445 is not needed in my case your comment was still helpful. I tried it and it did not work. So key was to find out which port is the blocking one.
This can be done with a simple netstat command. Performing netstat first when the connection is down and then netstat when the connection is up is a very simple way to find out which port must be openend.

SQL Server TCP/IP times out

I have to connect to a fresh SQL Server Express 2017 on a machine not part of my domain. I have configured
Mixed Mode Installation with sa with password
SSMS -> Server -> Properties -> Connections -> Allow remote connections
SQL Configuration Manager -> Instance "EXPRESS2017" -> TCP/IP: Enable and Active and Port 1438
Restarted the "SQL Server (EXPRESS2017)" service.
I now tried to access from a remote computer, and got a timeout. I then tried to connect from the local SSMS, which works without special settings, but when under options, forced "Protocol: TCP/IP" is set, with the same credentials as before, I also got a timeout.
So am I right that I can rule out the firewall or problems finding the instance, and everything points towards a configuration issue in TCP/IP protocol, or did I overlook some setting?
EDIT: I have disabled Windows firewall, and no other firewall is installed on the computer. I have restarted the computer. I also found this article about PortQry and had a check - locally:
C:\Users\Administrator\Downloads>PortQry.exe -n 172.17.41.124 -p UDP -e 1434
Querying target system called:
172.17.41.124
Attempting to resolve IP address to a name...
IP address resolved to WIN-AECL8CJVS7E.test.local
querying...
UDP port 1434 (ms-sql-m service): NOT LISTENING
EDIT: I have run NETSTAT and it seems no port in the 14xx range is open at all, although the SQL Server Browser service is running. I must be missing something there...
You did not show your connection string, but I suppose you use your instance name here.
In order to connect to SQL Server the network library has to know 2 things: IP address and a port. Your instance is named and uses non-default port 1438.
So your connection string should use 172.17.41.124,1438 as server name, or, alternatively, you can use instance name like this: 172.17.41.124\EXPRESS2017 but SQL Server Browser should run.

Can't connect to SQL Server on Server 2008 R2 VM; port 1433 is open

I have a virtual machine running Windows Server 2008 R2 and SQL Server 2008 R2. The host is running Windows 7. I can connect to the SQL server from the VM using SQL Server authentication, but I can't connect from the host using the same method and credentials. I can ping the VM from the host, but I can't telnet to port 1433. On the VM, port 1433 is open through the firewall, TCP/IP is enabled on the SQL instance, and all IP addresses in TCP/IP properties are enabled. I have verified that SQL Server is listening on port 1433. I've been trying to figure this out for two days and I'm about at wit's end. Any ideas?
The problem turned out to be the IP address I was trying to connect on. The VM would respond to pings, but nothing else was listening there, I take it. Changing the IP address for the VM in my hosts file to the first one listed under the VM's ipconfig fixed it. (I'd taken the IP address I was trying to use from SQL Server Configuration Manager, which got it from ???.) Our network guy figured it out for me, so I can't give more details, sorry.
Try this:
Goto SQL Server Configuration Manager from start menu then from the left pane choose SQL Server Network Configuration then choose your instance name..
Then from the right pane choose TCP/IP .. make sure it's enabled then :
In its properties > IP Addresses clear any field named TCP Dynamic Ports and for any field named TCP Port set its value to 1433

Connecting to SQL Server 2000 through TCP/IP on localhost failed

I have tried to connect to SQL Server 2000 through TCP/IP.
I followed these steps and enabled SQL Server 2000 on port 1433.
Then I used the command to test whether the port is opened up:
telnet localhost 1433
But I found the following error:
Connecting To localhost...Could not open connection to the host, on port 1433:
Connect failed
And I also failed to connect to the server by following these steps.
How to solve this problem and connect to Sql Server 2000 through TCP/IP?
See my configs
By default TCP-IP is disabled.
You need run SQL Server Configuration Manager->SQL Server Network Configuration and enable the protocol, then restart SQL Server service
Try disable your firewall temporarily and see if it makes a difference, to isolate the problem.
EDIT: Wait, did you enable TCP/IP on the client or server ? If you only enabled it on the client, then that explains it.
It must be enabled on both to allow communication. From your error, it looks like the server does not accept TCP connections. I don't remember what SQL 2000 calls the program, but find something like "SQL Server Network Configuration", not "Client Configuration". And turn on TCP there.
Perhaps show us a screenshot of your network configuration dialog.
I did following actions to remove this bug
1)Disable Other Protocols other than TCP/IP from SQL Server Client And Server Utilities
2)Re-Instal SQL Server 2000 sp4
I think you need to be running SQL Server Agent to connect via TCP/IP on 2000.
This behavior is by design:
http://support.microsoft.com/kb/929152
Use an alternative representation of the name of the local host address instead of "localhost". Possible alternative representations include the following:
127.0.0.1
"."
The actual local host name
Installed SQL Server 2000 SP4 and it solved the problem for me.

What port is a remote SQL Server 2005 running on?

How do I find what port is my remote SQL Server 2005 running on?
Unless it's modified, it's the default port 1433.
SQL Server's default port is 1433. If you are unable to connect, you may have to make sure your firewall settings are correct.
Alternatively you can find out which port SQL Server is running by opening your command prompt: (Start > Run > CMD). Type "netstat" and hit enter, this will show you what you're looking for.
You could also check SQL Server's Error Log on the remote server to determine the port. Here are some more intracate ways of determining the port.
Additional information about ports right here on SO.

Resources