Thursday, March 8, 2012

An error has occurred while establishing a connection to the server. error: 40

hi i got the following error message while connectiong to my sql server 2005

NB :i am connecting from the same pc where sq server is installed.

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. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 2)

Any idea?

Tarek

If you're using SQL Server 2005 Express, and you did the default install, and you're trying to connect using the sqlcmd utility, then you need to start sqlcmd like this:-

sqlcmd -S .\SQLEXPRESS

This is because the default for SQL Server Express is to install a named instance called SQLEXPRESS instead of the 'default' instance installed by other versions of SQL Server 2005.

|||I am using sql 2005 Enterprise editon on my laptop and I get the sam error. If someone knows how to resolve the problem please help, before sql 2005 I had sql 2000 installed. Thnx in advance .|||

Add me to the list of people having this problem.

Wylbur
============================

|||I installed sql server 2000 and run it. The problem solved. But I have to keep the 2000 running, otherwise, the problem will reappear.
|||Now THAT is vel-ly in-ter-es-tink.

OK guys: Does this suggest that there is a needed service that should be running at startup
but isn't?

... and, if so, which one(s)?

Wylbur
========================

|||

You can look at this blog for information on enabling remote connects. The blog is for the Express edition but this posting is applicable to all editions: https://blogs.msdn.com/sqlexpress/archive/2005/05/05/415084.aspx

Cheers,
Dan

|||

Having the same problem... here is how i resolved it.

Start -> Microsoft SQL Server 2005 -> Configuration Tools -> SQL Server 2005 Surface Area Configuration.

Configure Surface Area for localhost -> Surface Area Configuration for Services and Connections

MSSQLSERVER + Database Engine -> Remote Connections

Select 'Local and remote connections' instead of 'Local connections only'

Select the appropriate option under this option, i picked Using both TCP/IP and named pipes.

No comments:

Post a Comment