Connect to SQL-Server 2008 over TCP 1433 freetds

Posted on 2009-02-18
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.
Question by:lars_brinkmann
    LVL 26

    Expert Comment

    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...

    Author Comment

    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?
    LVL 25

    Expert Comment

    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..

    Author Comment

    SQL Server and Windows Authentication mode

    Accepted Solution

    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!


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Are end users causing IT problems again?

    You’ve taken the time to design and update all your end user’s email signatures, only to find out they’re messing up the HTML, changing the font and ruining the imagery. What can you do to prevent this? Find out how you can save your signatures from end users today.

    This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
    You might have come across a situation when you have Exchange 2013 server in two different sites (Production and DR). After adding the Database copy in ECP console it displays Database copy status unknown for the DR exchange server. Issue is strange…
    This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
    This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now