If you are receiving the following error related to connection to SQL Server, this blog is for you.
TITLE: Connect to Server
——————————
Cannot connect to Database Server.
——————————
ADDITIONAL INFORMATION:
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: 1326)
I suggest that you read previous article first as that describes how to fix the problem and has worked in many cases.
SQL SERVER – Fix : Error : 40 – could not open a connection to SQL server
Now if SQL Server can be connected perfectly from local system, but cannot be connected from a remote system, in that case firewall on the server where SQL Server is installed can be issued.
Follow instructions of this article to fix the issue.
Go to control panel >> Firewall Settings >> Add SQL Server’s Port to Exception List.
Now try to connect to SQL Server again. It will allow you to connect to the server successfully. Please leave a comment with your experience.
Reference: Pinal Dave (https://darkslategrey-bat-805937.hostingersite.com)
141 Comments. Leave new
Hi,
i was getting an error which i successfully resolved :)
“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)”
changing the server name from (local) to “localhost\\SQLEXPRESS” and it worked!
This solved my problem ..:)
Regards,
Syed Mujtaba Ahmed Razvi
This was exactly what I needed..
I had a new server installed in Deutsch and even though I can speak enough Deutsch day-to-day, I couldn’t get my way through all the interfaces to find the correct firewall setting without going slightly crazy.
These pictures helped me muddle my way through and now I can connect remotely to me new server :-)
Thanks Dave, as always a wealth of knowledge and one of the best SQL resources out there.
Cheers, Aaron.
Hi sir,
I have come across your blog and it is very informative. Currently, i have a very serious issue with SQL server connectivity.
I get the following error when i try to connect to SQL server from a client location ” A network related or instance specific error occured while establishing a connection to SQL server.The server was not found or was not accessible.Verify that the instance name is correct and that SQL server is configured to allow remote conenctions.( provider: Named Pipes Provider, error: 40 – could not open a connection to SQL server. )(Microsoft SQL server error : 53)
I tried connecting to the server from another client machine and it works fine. But, from my machine i am not even able to ping the server. Firewall is disabled, TCP/IP enabled, SQL services are running fine.
However, I am able to ping other sites.
Do you think it is a Network firewall issue?
Please please help me out with a solution.
hi niharika….
this is sridhar
go to windows firewall settings and press exceptions tab
and go for add port give the following details …
name : sql
port no: 1433
and select ” TCP ” radio button …..
Dear all,
I have a big problem, pls give me solution.
I ‘ve an app. In this app, client (C# win form) access to sql database thru web services (C#). If i deploy web services and Database on one server, it work ok. But if i deploy on 2 server (in LAN), it not work, the client fire exception 1326. The Data server with: OS Win Server 2003, SQL 2000.
When I use SQL Server Management Studio (on Services Server) to connect to Data Server this connected. I’m enabled TCP/IP and Named Pipe too, Firewall is Turn off.
Help me pls.
tring chuong
I have a problem with ODBC, and SQL connectivity. Let try to explain.
The SQL server runs on our DATA BASE SERVER with and OS Windows Server 2003.
The ODBC CLIENT runs on our Application Server OS Windows Server 2008 64 bit.
After configuration of ODBC and pointing the connection to the DATABASE required. The ODBC returns an error 10016 and further indicates that it is unable to connect to the TCP socket.
We have configured the TCP/IP port and added the exception to the fire wall as per this sites instruction but still no luck.
We noted that 10016 seems to suggest registration errors, we are reluctant to run the reg edit as these are all fresh installations. Also the down load program for reg edit only supports the 2003 and not the 2008.
is it possible that we have compatibility issues with the different OS
or should we be looking else where
Can anyone help in this regard
I have same error message but the scenario is different.I have a xp machine with sql server 2000.When i connect that db from my client xp machine sql server 2005 it connects but when i try to connect from windows server 2008 with sql server 2005 it give me error message as shown above in article.
Nice….it resolved my problem n helped me to learn a new thing today.
Iam getting the error.
Login failed for user””error 18546
as i try to connect to sqlserver 2005 on a sever
Pliz help
I never did get around this problem. But I found I could get the Developer Version of SS 2008 from M$ for only $60, so I ordered it and installed it on my computer. I got all kinds of errors saying it was not compatible with Win XT, but I ignored them and it installed okay. Now I have SQL Server and I can also do BIDS, SSIS, SSRS and have all the functionality SQL Server has. It was so much better than the free versions of SS and the features of that version allowed me to learn enough to land a new contract which will carry me for a few years.
Here’s a definite way to solve this problem.
Open SQL Server 2008
At Server name select ‘browse for more’
Go to Network Servers and select the listed server(which would be like [URPCNAME]/[INSTANCENAME]).
Connect using Windows Authentication mode and u are done!
Hi! People
For me solution that worked was adding alias with external IP on “client networking tool” option
Thanks, i have fixed my error related to MSSQLServer from this blog , Thanks for Mr. Pinal kumar Dave for a great effort
Hello Pinal,
I need your help.
i have made one application in C#.net 2008,basically application work for Server-Client architecture (LAN Network).
i made the setup of my application and its connecting perfectly fine on server where sql server express 08 install.i have install my application on client machine also and then after when ever running the application from client machine its refused to connect with sql server express its throws my coding generate message like “Unable to establish your connection to data source.Configure your setting and restart your application”
when i start the application at that i have configure like that its ask to enter the sql server name then its generate the connection string and connect it.
i am using standard connection string…
“Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;”
Can you help me in that what kind of problem is that.Can you assist me please.
waiting for your reply
hi thanks in advance…..
i am installing visual studio 2008 in my system and the database is sql server 2005 management studio express edition , when i am trying to connect sql server 2005 management studio express edition it gives following error….
please help me anybody….
the error is : Connect to server
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server) (.Net SqlClient Data Provider)
Hi all,
Non of above solutions worked for me :(
Error message –
Server is not available. Check Web.Config and database configuration.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server)
This is my connection string syntax –
1. I am using SQL Server 2005, Studio Express (free edition) on Windows Server 2003 SP2
2. SQL server is running on the same box as the IIS server
3. Added exceptions on the firewall
4. Made sure that SQL Server and Server Browser are running on services
5. TCP/IP in enabled under SQL Server Configuration
Jenish
Hi all,
I have installed Navision in 2008 server with SQL2005. While opening a database from client side I am getting an error message like
Error:[Microsoft][ODBC SQL Server Driver] Timeout expired State ID: HYT00
But if I include the user in local Administrator group then I am able to open the database without any error message.
Note: The clients are not under domain
Anybody can help me out to solve this issue.
Sridhar
Hello,
I have two servers A and B. I want to connect server B from server A and create a new database. This has to be done using stored procedure.
Please give me reply ASAP.
Thanks
I can’t connect to database from c# to Sqlserver 208 R2
What is the error you are getting?
give me suggestions about any error
What did you mean by any error?
Thanks for this post, were able to also get it working in 10 minutes :)