An error has occured while establishing a connection to the server...


  • Hi folks,

    I have been trying to figure out how to establish a remote connection to a database on SQL Server 2005, but no matter the approach, I'm met with this result: "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. error:26 - Could not open a connection to SQL Server."


    The machine I have the server on is a OS Vista Ultimate, 2 gigs ram, 2.86 GHz processor.

    I'm trying to access from another 2 types of machines - both laptops with Vista Ultimate.


    I have run the configuration tool on the server machine to allow local and remote connections for the database engine, as well for the browser, but to no avail. 


    I have the developer version of SQL 2005 installed on all three machines, but don't know if that is a reason for not being able to establish a connection.


    I've tried to connect via a test application; also via Visual Studio, and also directly from SQL Server on the machines.

    None of the machines can access the database any of the others, regardless of the configuration. 


    They all display the very same error.


    I'm really in need of some help with this, any ideas?





    Monday, December 03, 2007 7:36 PM

All replies

  • Gary,


    You have to make sure that when you want to connect remotely to SQL on Vista or anything other than a Server OS, that you allow it through the firewall.  You either can allow the service or application (sqlsrver.exe) through.  Ports 1433 TCP and 1434 UDP.


    Then you should be able to connect.


    Tuesday, December 04, 2007 4:49 AM

    Hi Ben, thank you for the reply.


    I've also created exceptions in the firewall explicitly for sqlsrver.exe for the installed version.  I have Windows Live One Care running on these machines as well.


    Where would I establish open prots specific to SQL at this point?

    Tuesday, December 04, 2007 4:21 PM
  • As it turns out, I have the developers version SQL Server 2005 on my Vista box, which doesn't allow remote connections. DUH!


    So, I set up a Windows Server 2003 Enterprise system, and installed SQL Server 2005 Enterprise; ran the configuration wizard on the Windows Server and set it up as an application server. I ran the services configuration tool and set it to allow both local and remote connections, and use tcp\ip .  I can access the server via a small home network, which has 3 desktops and 4 laptops, and a set as a work group rather than a domain.


    I then attempted a connection through the Windows Server to a data base on Sql Server, from the Vista box using Visual Studio 2005 Pro server explorer, and the connection failed, and returned the stated message at the start of this thread.


    Any one have any ideas related to this?


    Friday, December 07, 2007 2:48 AM
  • Thank you! I was sooo looking in the wrong place...your post helped me out and I can access my system fine now!

    Tuesday, December 18, 2007 9:37 AM
  • Great! Now if I could get some help with the problem I'm having!!


    Tuesday, December 18, 2007 12:26 PM
  • Gary,


    One question for you is are you running Visual Studio as Administrator, you are running it under Vista?  (Right click on the shortcut and choose Properties, and under the Compatability tab you will see at the bottom, Run as Admininstrator)


    You should run it as Admin in order to use Windows Auth.




    Wednesday, December 19, 2007 5:16 AM
  • Hi Ben, true enough and I do.   I think what I'm finding is a login or crediential problem with SQL Server.  I can login to Windows Server, but cannot login to the SQL Server.






    Wednesday, December 19, 2007 12:41 PM
  • Right, and you would want to make sure that the Windows Groups like BUILTIN\Administrators are in the Security section of SQL Server.


    Monday, December 31, 2007 8:26 PM
  • Hi i know the link which will be helpfull for u

     in this error

    if you find this is the answer you were lookuing don't forget to post comment


    Thursday, July 16, 2009 5:44 AM