Link to home
Start Free TrialLog in
Avatar of Eric Christianson
Eric ChristiansonFlag for United States of America

asked on

SQL Server does not allow remote connections - VISTA Ultimate, SQL 2005, VS 2005

When my Web application tries to connect to SQL I receive the following error message:
"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."
I have wiped my machine and reinstalled the OS from the manufacturer-supplied recovery disk.  I have installed SQL 2005 (Dev) and VS 2005 (Dev) on a new VISTA Ultimate machine, running 64-bit.  I have tried numerous solutions to this issue from here and from Google.  
1.  I am ruining everything as administrator
2. My SQL Installation is a named installation.
2. In the Configuration Manager, all six of my Services are running, including SQL Server Browser.
3. TCP/IP and Named Pipes are Enabled in all of the available Protocol dialogs.
4.  I have stopped and started all the services and rebooted my machine numerous times.
5. I have checked all the settings in the Surface Area Manager as well - they seem to jive with the Configuration Manager.
6. I am using Windows Authentication, and LocalHost
7. I am at my wits end, and after 15 years, seriously considering a new line of work.
ANY suggestion would be appreciated.
Thank you for your time and attention.
Avatar of Bradley Haynes
Bradley Haynes
Flag of United States of America image

To double check, do the following:
1. make sure that server and client use the same network protocol (enable TCP/IP).
2. Enable the service SQL Browser from your server.
3. Enable 'Allow remote connections' setting in the server.
4. check your server/workstation firewall.

If all else fails . . . Go back to the drawing board.
It is like when you first put your socks on. After a while it is just there.

Follow these steps to configure SQL Server 2005 to allow remote connections:

1. Click Start, point to Programs, point to Microsoft SQL Server 2005, point to Configuration Tools, and then click SQL Server Surface Area Configuration.
2. On the SQL Server 2005 Surface Area Configuration page, click Surface Area Configuration for Services and Connections.
3. On the Surface Area Configuration for Services and Connections page, expand Database Engine, click Remote Connections, click Local and remote connections, click the appropriate protocol to enable for your environment, and then click Apply.

Note : Click OK when you receive the following message:
Changes to Connection Settings will not take effect until you restart the Database Engine service.
4. On the Surface Area Configuration for Services and Connections page, expand Database Engine, click Service, click Stop, wait until the MSSQLSERVER service stops, and then click Start to restart the MSSQLSERVER service.

You can get more details from : http://support.microsoft.com/kb/914277
Avatar of Eric Christianson

ASKER

Hi -
I've been through (part) of this resolution several times already, but thank you for the step by step instructions.  At least it shows me that I have been doing it right.  Under Remote Connections, I have the radio button labled 'Using both TCP/IP and named pipes' selcted.
Any other ideas?
2. My SQL Installation is a named installation.
6. I am using Windows Authentication, and LocalHost

... ehm than you should use 'LOCALHOST\INSTANCENAME' and not just localhost as servername ...

Hope this helps ...
My Server Name is 'ECE'.  My Admin UserName on the machine is 'ECC'.  Where would I enter or expect to see my version of your example string?  (in my case 'localhost\ECE' ??
Your web app tries to connect to the SQL Server using a connection string ... in there it might say:

Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=<YourDB>;Data Source=localhost\ece

hope this helps ...
Where are my heart pills when I need them...  I have a different error message (!!!) - this one much more familear.  Yveau, if you could just hang in there just a little longer...
"Login failed for user 'ECE\ECC'  The user is not associated with a tructed SQL Server Connection'
My web.config looks like this right now:
<appSettings>
      <add key="dbServerName" value="localhost\ECE"/>
      <add key="database" value="LMOL"/>
      <add key="dbUserName" value="ECE\ECC"/>
      <add key="dbPassword"/>
Where is SQL do I make a change?
Aha, that one is familiar as well :-)

You are mixing up the two authentication modes for SQL Server.
1. There is SQL Server authentication, and for that to work, you need to enter a SQL login/Password in the connection parameters as you are doing.
2. There is Windows integrated security, and for that to work you may NOT enter a login password in the connection parameters (otherwise SQL switches to SQL authentication)

so I guess it will be something like:
<appSettings>
      <add key="dbServerName" value="localhost\ECE"/>
      <add key="database" value="LMOL"/>
      <add key="dbUserName" value="sa"/>
      <add key="dbPassword"/>
or
<appSettings>
      <add key="dbServerName" value="localhost\ECE"/>
      <add key="database" value="LMOL"/>

Hope this helps ...
Well, 'sa' doesn't work (currently) in my web.config.  If I open up SQL, where do I go to change it from Windows Authentication to SQL Server Authentication?
Hang on !!! I wasn't clear enough. My fault !
It's either ONLY windows auth. or BOTH SQL and windows auth.

So you can set it to Mixed mode as they call it, this way:
In SSMS, open a connection to the server. Then in the object explorer, right click the name of the server, select properties. Then go to the security page and click the radio button saying 'SQL Server and Windows Authentication Mode'.

Next to that, using the sa account is REAL bad practice. So please, create another SQL login, and use that one for the application. ... testing the whole package using sa is of course OK ... but don't forget to change it as soon as it works ...

Hope this helps ...

... and when you create another login, also create an accompanying user in the correct database ... otherwise you still won't be able to get into the database you need.

Almost there, I can feel it.  There is still something wrong.  Same error message Login failed for user 'sa'.  My web.config looks like:
      <appSettings>
            <add key="dbServerName" value="localhost\ECE"/>
            <add key="database" value="LMOL"/>
            <add key="dbUserName" value="sa"/>
            <add key="dbPassword"/>
My server properties show 'SQL Server and Windows Authentication' checked.  
I do not have a Server proxy account, even through there is a (disabled) password in the password field.  
In my old machine, which uses a default SQL install (not named), my 'sa' acoount was ONLY a SQL Server Authentication (there was no option for mixed).
What next?
We're going to get there ...

You still need to pass the sa password:
      <appSettings>
            <add key="dbServerName" value="localhost\ECE"/>
            <add key="database" value="LMOL"/>
            <add key="dbUserName" value="sa"/>
            <add key="dbPassword" value="secret"/>

If you do not know the password, first reset it using SSMS.

... hope this helps.
That's the problem.  I don't know where to set the password.  If I click on the Enable Server Proxy Account checkbox, and enter 'sa' in the proxy account field, the pre-loaded password remains intact regardless of what I type or if I stop the server and restart.  Is this where I add a password for 'sa'?
Stop, the proxy account is something different.
Check this:
In SSMS, connect to the server.
In the object explorer pane, open the server and open the security folder and open the logins folder.
Right click on 'sa' and select properties.
There you have the password ... enter it twice and you should be fine.

Hope this helps ...
I have to get my kids - I'll be back in 30 minutes...

Login was  Disabled - I enabled it.
User Mapping (unmapped) - I mapped it to my db.
Now I get Cannot use the special principal 'sa'.  eccent  Error 15405

(weep)  I'll be back
ASKER CERTIFIED SOLUTION
Avatar of Yveau
Yveau
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank You, Thank You, Thank You.  I came back and tooled around with a new Login User, had some issues with granting access, etc., but eventually I was able to connect and get to my data.  I probably do not have an optimal set-up, but it works, and I can move on.
I am a decent programmer, but its been a while since I had to futz with installing SQL, and doing so in a new environment like VISTA is, in my opinion, ridiculously complex.  Five weeks ago I bought a new machine to speed up my dev experience.  I have contacted Experts Exchange on three different issues including this one, just to get SQL installed and working.  Today I can say I am finally moving forward.  There has to be a better way.
Thank you for your time and attention, Yveau.  You really were a good source of useful information
Glad I could be of any help and thank you for the grade !
Avatar of yitbos33
yitbos33

Thank you for this thread. I spent hours trying to get connected, and it finally dawned on me after reading this thread that I needed to put the instance name after the hostname in order to access the sql server remotely...Much obliged
:-) Cool ... now we're even helping out without doing anything !
Happy SQLing !