Home | Contact | Index | SenSource, Inc.
Guides | How To | Errors | Troubleshoot | FAQ | Glossary Search Start Searching...
Home > Home > Errors > SQL Server 2008: Cannot Connect to Remote Server

SQL Server 2008: Cannot Connect to Remote Server

Last Updated: 3/31/2010 2:42:31 PM

Symptom
When you try to connect to an instance of Microsoft SQL Server 2008 from a remote computer, you may receive one of the following error messages:
"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2008, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connection. (provider: SQL Network Interfaces, error 28 - Server doesn't support request protocol) (Microsoft SQL Server)"
"Login failed for user 'sa'. The user is not associated with a trusted SQL Server connection. (Microsoft: SQL Server. Error: 18452)"
 
Possible Causes
  1. This problem may occur when SQL Server 2008 is not configured to accept remote connections. By default, SQL Server 2008 Express Edition does not allow remote connections.
  2. Windows Firewall on Windows Server 2008 helps prevent unauthorized access to computer resources. However, if the firewall is configured incorrectly, attempts to connect to an instance of SQL Server may be blocked. To access an instance of SQL Server that is behind the firewall, you must configure the firewall on the computer that is running SQL Server.
 
Resolution
» Enabling Remote Connections
  • Verify that both SQL Server and Windows Authentication modes are enabled.
    1. Log into SQL Server Management Studio Express on local SQL Server with Windows Authentication user.
    2. In Object Explorer, right-click on the instance name and select Properties.
    3. On the left, select Security and change Server Authentication to SQL Server and Windows Authentication and click OK.
    4. A pop-up will appear advising that SQL Server must be restarted for the changes to take effect. Click OK.
    5. In Object Explorer, right-click on the instance name and select Restart.
    6. Click Yes at the verification pop-up.
    7. Wait for the service to stop and start.
  • Verify that remote connections are enabled in SQL Server Surface Area Configuration.
    1. Open SQL Server Surface Area Configuration.
    2. Under Configure Surface Area for [computername], select Surface Area Configuration for Services and Connections.
    3. On the left side, expand your SQL Service Instance » Database Engine » Remote Connections.
    4. On the right side, select Local and Remote Connections and Using Both TCP/IP and Named Pipes.
    5. On the left side, expand SQL Server Browser » Service.
    6. On the right side, if the startup type is Disabled, change it to Automatic, click Apply, and then click Start to initiate the service. Click OK.
  • Check whether the problem is fixed by trying to access the instance of SQL Server from another computer. If the problem is not fixed, proceed to Configuring Windows Firewall.
» Configuring Windows Firewall
    Option 1: Microsoft Fix It 50169
  1. To fix this problem automatically, click here.
  2. Click Run in the File Download dialog box, and then follow the steps in this wizard.
  3. Check whether the problem is fixed by trying to access the instance of SQL Server from another computer. If the problem is not fixed, proceed to Option 2.
  • Note: This wizard may be in English only; however, the automatic fix also works for other language versions of Windows.
  • Note: If you are not on the computer that has the problem, save the Fix It solution to a flash drive or a CD and then run it on the computer that has the problem.
    Option 2: Manually Enter Script to Open Firewall Ports
  1. Launch/Open your Notepad application.
  2. Copy and paste the following code into Notepad:
    @echo ========= SQL Server Ports ===================
    @echo Enabling SQLServer default instance port 1433
    netsh firewall set portopening TCP 1433 "SQLServer"
    @echo Enabling Dedicated Admin Connection port 1434
    netsh firewall set portopening TCP 1434 "SQL Admin Connection"
    @echo Enabling conventional SQL Server Service Broker port 4022
    netsh firewall set portopening TCP 4022 "SQL Service Broker"
    @echo Enabling Transact-SQL Debugger/RPC port 135
    netsh firewall set portopening TCP 135 "SQL Debugger/RPC"
    @echo ========= Analysis Services Ports ==============
    @echo Enabling SSAS Default Instance port 2383
    netsh firewall set portopening TCP 2383 "Analysis Services"
    @echo Enabling SQL Server Browser Service port 2382
    netsh firewall set portopening TCP 2382 "SQL Browser"
    @echo ========= Misc Applications ==============
    @echo Enabling HTTP port 80
    netsh firewall set portopening TCP 80 "HTTP"
    @echo Enabling SSL port 443
    netsh firewall set portopening TCP 443 "SSL"
    @echo Enabling port for SQL Server Browser Service's 'Browse' Button
    netsh firewall set portopening UDP 1434 "SQL Browser"
    @echo Allowing multicast broadcast response on UDP (Browser Service Enumerations OK)
    netsh firewall set multicastbroadcastresponse ENABLE
  3. Save the file as a .txt file by using the following name: OpenSqlServerPort.txt
  4. Rename the OpenSqlServerPort.txt file to the following: OpenSqlServerPort.bat
Before you run the OpenSqlServerPort.bat script, you must copy the script to the computer that has the firewall, and then run the script on that computer. To run the script, follow these steps:
  1. Click Start, click Run, type cmd, and then click OK.
  2. At the command prompt, use the cd command to navigate to the folder in which you saved the OpenSqlServerPort.bat file.
  3. To run the OpenSqlServerPort.bat script, type OpenSqlServerPort.bat at the command prompt, and then press ENTER.
  4. Check whether the problem is fixed by trying to access the instance of SQL Server from another computer. If the problem is not fixed, proceed to Option 3.
    Option 3: Add SQL Server Executable to Blocked Exceptions
  1. In the Windows Firewall dialog box, on the Exceptions tab, click Add Program.
  2. Click Browse, and navigate to the instance of SQL Server that you wish to access through the firewall, and then click Open. By default SQL Server is at C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\Sqlservr.exe.
  3. Click OK twice to close the Windows firewall program.
  4. Check whether the problem is fixed by trying to access the instance of SQL Server from another computer. If the problem is not fixed, contact support.
  • Use this method when your SQL Server uses dynamic ports.
  • Only one instance of SQL Server can be accessed in this way.
 
Guides | How To | Errors | Troubleshoot | FAQ | Glossary | Contact | Index | SenSource, Inc.
© 2010 SenSource, Inc. All Rights Reserved. 3890 Oakwood Ave. Youngstown, OH 44515