We help IT Professionals succeed at work.

Connect to SQL-Server 2008 over TCP 1433 freetds

Medium Priority
Last Modified: 2012-05-06
I want to connect from a redhat system with PHP / freetds to SQL-Server 2008 on Windows Server 2008.

Result: Server is unavailable or does not exists

Connecting to an further SQL-Server works without any problems, so the error is located on the SQL-Server or on the Windows Server 2008

Connecting with the Management Studio: success
ping: success
netstat -a: no listening task on 1433
telnet server 1433: failed
tsql -H server -p 1433 -U sa: failed "Server is unavailable or does not exists"

TCP and Named Pipes on
TCP Port 1433

[Windows Server 2008]
Firewall off
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.(InstanceName)\MSSQLServer\SuperSocketNetLib\TCP\IPAll) and the port is set to 1433.

So I think the SQL-Server does not listen on port 1433. So what could be the problem or what I have to connect to this sql-server over tcp 1433.

Thanks for your help.
Watch Question

sql server uses dynamic port.. you can learn the oport number that is listened by yoyur server fron the registry entry

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.(InstanceName)\MSSQLServer\SuperSocketNetLib\Tcp','TcpPort' ,PortNum

if the port number is correct then check whether your server is configured for remote connections? You should need to enable it...


HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.(InstanceName)\MSSQLServer\SuperSocketNetLib\Tcp','TcpPort' ,PortNum
checked: is 1433

Remote connections is activated. But still it does not work.
The user for the connection is the sa. Is this a problem?

What is the authentication supported in the backend? Windows, SQL or Mixed??

If it is windows authentication or trusted connections only, the sa login can possibly login only from within the server..


SQL Server and Windows Authentication mode
I found the solution. The IPALL configuration overides all other configurations in tcp.
What I did to connect to sqlserver 2008 over tcp

1.) Firewall: open tcp 1433 in/out
2.) Activate SQL-Server authentication mode
3.) enable remote connections
4.) HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.(InstanceName)\MSSQLServer\SuperSocketNetLib\Tcp','TcpPort' ,PortNum
5.) Activate tcp in sql server configuration manager
6.) Enable and Activate TCP + Dynamic Ports = 0 (off), Port 1433
7.) IPALL Port 1433

How you can test it:
netstat -a must show a listening task at 1433
telnet server 1433 have to connect to the server

Thanks all for help!

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.