Error has occurred while establishing a connection to the server
Sqlcmd: Error: Microsoft SQL Native Client: 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.
Are you panic with this type of error then it’s no more, I have found a solution with many attempts to solve this error which I was facing and making my head down.
Whenever you connect to to SQL Server 2005 database including express edition and standard edition and professional the error may occur .To resolve this error just follow these steps it was found by me after many attempts to solve my error and finally landed out with a solution .
The error may look like this
Sqlcmd: Error: Microsoft SQL Native Client: 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.
There are 4 ways to get rid of this error.
- Enable remote connections
- Check SQL Server Browser service.
- Ensure the configuration of firewalls is allowing network traffic related to sql server and server browser service.
- Check for the Computer Name.
Enable remote connections
This error occurs because under default configuration the sql server will not be configured to accept remote connections.
To enable remote connections just follow the steps
Click on start->Programs->Microsoft Sql server 2005->Sql server configuration tools-> Sql server Surface area connection as below
Click the text which is highlighted and u will we will get a new a new screen. In the new screen enable select Remote connections and check the radio buttons as shown is the figure.
Enable SQL Server Browser service.
If the service is stopped start the service this will not be the case usually,make startup automatic and then click apply.
Check for the Computer Name.
The computer name should match with our server name of SQL Server .





