Search:     Advanced search

Cannot connect to Microsoft SQL Server on network

Article ID: 8
Last updated: 04 Mar, 2014
Revision: 7

Symptom

When you try to connect to an instance of Microsoft SQL Server 2005 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 2005, 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 2005 is not configured to accept remote connections. By default, SQL Server 2005 Express Edition and SQL Server 2005 Developer Edition do not allow remote connections.
    • Refer to Enabling Remote Connections.
  2. Windows Firewall on Windows Server 2005 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.
    • Refer to Configuring Windows Firewall.
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 SQL Server 2005 uses an instance ID as part of the path when you install its program files. To create an exception for each instance of SQL Server, you must identify the correct instance ID. To obtain an instance ID, follow these steps:
    Step 1
  1. Click Start, point to Programs, point to Microsoft SQL Server 2005, point to Configuration Tools, and then click SQL Server Configuration Manager.
  2. In SQL Server Configuration Manager, click the SQL Server Browser service in the right pane, right-click the instance name in the main window, and then click Properties.
  3. On the SQL Server Browser Properties page, click the Advanced tab, locate the instance ID in the property list, and then click OK.
    Step 2
  1. To open Windows Firewall, click Start, click Run, type firewall.cpl, and then click OK.
  2. In Windows Firewall, click the Exceptions tab, and then click Add Program.
  3. In the Add a Program window, click Browse.
  4. Click the C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\sqlservr.exe executable program, click Open, and then click OK.
    • Note: The path may be different depending on where SQL Server 2005 is installed. MSSQL.1 is a placeholder for the instance ID that you obtained in step 3 of the previous procedure.
    • Repeat 1-3 for each instance of SQL Server 2005 that needs an exception.
  5. From the Exceptions tab, click Add Program again.
  6. In the Add a Program window, click Browse.
  7. Click the C:\Program Files\Microsoft SQL Server\90\Shared\sqlbrowser.exe executable program, click Open, and then click OK.
    • Note: The path may be different depending on where SQL Server 2005 is installed.
  8. From the Exceptions tab, click Add Port.
  9. In the Add a Port window, enter SQL Port 1433 for the Name.
  10. Enter 1433 for the Port Number.
  11. If not already checked, select the radio for TCP and then click OK.
  12. From the Exceptions tab, click Add Port.
  13. In the Add a Port window, enter SQL Port 1434 for the Name.
  14. Enter 1434 for the Port Number.
  15. If not already checked, select the radio for TCP and then 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, contact support.
    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.
Prev   Next
System Manager Troubleshooting     Correcting times in historical data after neglecting to set the...


[ www.sensourceinc.com ]