provider named pipes provider error 40 - could not open a connection to sql server 2008 - sql-server-2008

SQL Server Name : ECARE432
Instance Name : SQLEXPRESS
app.config contains:
<connectionStrings>
<add name="TimeTracker.Properties.Settings.myecareConnectionString"
connectionString="Data Source=ECARE432;Initial Catalog=myecare;Persist Security Info=True;User ID=sa;Password=ecare123#"
providerName="System.Data.SqlClient"/>
</connectionStrings>
I have developed my first application in WPF (C#) with VS 2008 & SQL Server 2008. It works fine on my system. After deployment, it doesn't work on other systems.
It shows the following error message.
provider named pipes provider error 40 - could not open a connection to sql server 2008
I have gone through Google and done the following steps but no use.
Configuration Tools -> SQL Server Configuration Manager -> SQL Native Client Configuration Aliases -> Alias Name -> ECARE432,1433, Port Number -> 1433, Protocol -> TCP/IP, Server Name -> ECARE432
TCP/IP is enabled. Protocols -> TCP/IP Properties -> IP1 -> Active - Yes Enabled - Yes, IP Address - My system IP address, TCP Dynamic Ports - Blank, TCP Port - 1433
IP2 -> Active - Yes, Enabled - Yes, IP Address - 127.0.0.1, TCP Dynamic Ports - Blank, TCP Port - 1433
IPALL -> TCP Dynamic Ports - Blank, TCP Port - 1433
SQL Server Browser is running.
Server Name is correct. No typo mismatch.
Client machine is able to ping my machine. (PING ECARE432 is working)
TCP 1433 and UDP 1434 Exception added to Firewall. Also Turned off the Firewall in both my system and the client system.
sqlbrowser.exe is added to the Firewall Exception List.
Allow Remote Connections enabled under Connections in SQL Server Properties.
Visual Studio --> Tools --> Options --> Database Tools --> Data Connections --> Changed "SQL Server Instance Name" from sqlexpress to blank.
Please guide me how to fix this issue.

If you have SQL Server Name: ECARE432 and Instance Name : SQLEXPRESS - then you need to use ECASE432\SQLEXPRESS as the value for your Data Source= in your connection string:
<connectionStrings>
<add name="TimeTracker.Properties.Settings.myecareConnectionString"
connectionString="Data Source=ECARE432\SQLEXPRESS;Initial Catalog=myecare;Persist Security Info=True;User ID=sa;Password=ecare123#"
providerName="System.Data.SqlClient"/>
</connectionStrings>
Along the same lines - if your instance really is called SQLEXPRESS - then why are you doing this??
Visual Studio --> Tools --> Options --> Database Tools --> Data Connections --> Changed "SQL Server Instance Name" from sqlexpress to blank.
Makes no sense at all. If the instance is in fact SQLEXPRESS - let it be!

Related

error: 26 - error locating server/instance specified

This is Arun from Chennai. I have developed my first application in WPF (C#) with VS 2008 & SQL Server 2008. It works fine in my system. After deployment, it wont works in other systems. It shows the following error message.
system.data.sqlclient.sqlexception - 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 instance name is correct and sql server is configured to allow remote connections.(provider: sql network interfaces, error: 26 - error locating server/instance specified).
I have gone through the google and done the following steps but no use.
Server Name : ECARE432\SQLEXPRESS
Instance Name : SQLEXPRESS
App.Config have:
<connectionStrings>
<add name="TimeTracker.Properties.Settings.myecareConnectionString" connectionString="Data Source=ECARE432\SQLEXPRESS;Initial Catalog=myecare;Persist Security Info=True;User ID=sa;Password=ecare123#" providerName="System.Data.SqlClient"/>
</connectionStrings>
Visual Studio-->Tools-->Options-->Database Tools-->Data Connections-->
Changed "SQL Server Instance Name" from "sqlexpress" to blank.
Configuration Tools->SQL Server Configuration Manager->SQL Native Client Configration
Aliases->
Alias Name -> ECARE432\SQLEXPRESS,1433
Port Number -> 1433
Protocol -> TCP/IP
Server Name -> ECARE432\SQLEXPRESS
SQL Server Browser is running in my system.
Server Name is correct. No typo mismatch.
Client machine is able to ping my machine.
TCP 1433 and UDP 1434 Exception added to Firewall. Also Turned off the Firewall in both my system and the client system.
Please guide me how to fix this issue.
I have removed the instance name in the connection string. Just I have changed the "Data Source=ECARE432\SQLEXPRESS;" into "Data Source=ECARE432" in the app.config connection string. It works now.

Login failed for user 'sa'

I am trying to connect to a sql server in my asp.net application. I have given connection string in my web.config as follows :
I am getting following error while running the application :
"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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"
If i use remote server's ip address as data source in connection string, I get following error
"Login falied for user 'sa'"
I researched and found some ports need to be opened between the server and my machine, which I got done by network team, still the same issue. How to resolve this ?
You can not directly. you need to have TCP/IP enabled and configured the TCP/IP Ports on sql server configuration manager at remote server.
you need to have TCP/IP connectivity .Just launch it, enter the DNS host name or IP address in the Server Name' box and hit Connect. The hosting company needs to have enabling TCP/IP on your SQL Server instance, and them providing you with secure access to the IP address that instance is running on.
Most administrators do not allow direct access to the SQL Server from outside the firewall. In that case, if you can connect to the host over VPN then you should be able to connect directly to the server with Enterprise Manager or SQL Management Studio.
Please go through it Configurations-Remote-Server
Are you porting code from Hypersonic or H2? If so, the username sa won't work.

SQL Server add host for connection string

My server name now is AVI-PC\SQLEXPRESS and it is working, I want to add an other host to the SQL Server.
I want to add sqllocalhost\SQLEXPRESS.
So I went to etc/host and added the following line:
127.0.0.1 sqllocalhost
but I could not connect.
So I ping to AVI-PC and I got the following address: fe80::bdc4:33a7:b403:d7f6%10.
So I tried to add
fe80::bdc4:33a7:b403:d7f6%10 sqllocalhost
and still not working.
(I have restart the server and the PC).
Edit
This is the config:
this is the exception:
===================================
Cannot connect to sqllocalhost.
===================================
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)
You want to create an SQL Server alias. Right?
Let's say you have
SEXYMF-PC\SQLEXPRESS
And you want to connect to that server with a different name: dev\SQLEXPRESS
To do that you need to go to Start > All Programs > Microsoft SQL Server 2008 > Configuration Tools > SQL Server Configuration Manager
Once it opens you will see:
SQL Native Client 10.0 Configuration
Client Protocols
Aliases
Right-click on Aliases and click on New Alias. There you enter
Alias Name = dev\SQLEXPRESS
Port No =
Protocol = TCP/IP
Server = SEXYMF-PC\SQLEXPRESS
Click ok and thats it. You can now connect to your SEXYMF-PC\SQLEXPRESS using dev\SQLEXPRESS
EDIT:
Can you connect to "SEXYMF-PC\SQLEXPRESS" using SQL Server Management Studio? If yes, there try to connect to your alias name: dev\SQLEXPRESS. Does it work?
Concerning this message:
(provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
1. Check if you have your SQL SErver Browser service on
2. Check again SQL Server Configuration Manager under - SQL Native Client 10.0 Configuration > Client Protocols > Named Pipes - and set to Enabled (if it is disabled).

Sql Server 2008 remote access problem

I have problem with connecting to Sql Server from my local machine.
Seems like I did everything I could, but still I'm unable to connect to it.
This is what I did:
1) Right click on Sql Server in Sql Management Studio (SMS) -> Connections -> Allow remote connections
2) Right click on Sql Server in Sql Management Studio (SMS) -> Security -> Allow remote connections -> Set Auth mode to Win and Sql auth mode (i.e. mixed mode)
3) Disabled firewall
4) Sql Server Configuration Manager -> Network Configuration -> Protocols -> Enable Shared memory, Named pipes, TCP/IP
5) Sql Server Configuration Manager -> Network Configuration -> Protocols -> TCP/IP -> Properties -> Set TCP Port to 1433, Set TCP Dynamic Port to 0. After that I restarted MainSql service in "services.msc"
6) I ran "EXEC xp_readerrorlog 1" in SMS, found this:
Server is listening on [ 'any' 1433].
Server is listening on [ 'any' 1433].
Server local connection provider is ready to accept connection on [ \.\pipe\SQLLocal\MAINSQL ].
Server named pipe provider is ready to accept connection on [ \.\pipe\MSSQL$MAINSQL\sql\query ].
Server is listening on [ ::1 64825].
Server is listening on [ 127.0.0.1 64825].
7) Tried to telnet [myip] 1433 from my home machine. Result: connecting To [myip]...Could not open connection to the host, on port 1433
: Connect failed
8) Tried to telnet [myip] 1433 from server - it worked!
Seems like this is some kind of a network issue. I have another server with Sql Server installed, I did the same on it and I was able to connect to it from my home machine, but not this one! I tried to connect to this server from the second one and it didn't work too.
Please help me, I don't know what to do. I did everything I could but it still doesn't work.
Update:
Sql Server Browser service is started on the server machine. The server is a dedicated server at a hosting, I'm trying to connect to it from my home machine and from another server witch is a dedicated server as well, from another country.
The problem was in firewall. To fix it I ran a script from here: http://support.microsoft.com/kb/968872
This is really strange because I fully disabled server's firewall. However it now works for me, thanks to cairnz and Gregory A Beamer for help.
It looks like you hit one of two most likely causes: You have set protocols. Just double check the client side to ensure the same protocols are enabled on both sides and you are done there.
The second most likely, with SQL 2005 on, is the Browser service is turned off on the server. If this is true, you will often have issues with remote calls, ala http://support.microsoft.com/kb/914277.

Accessing SQL Server 2008 R2 Express with SQL Server Management Studio

OK maybe I'm being stupid somehow, and my googleing has not found a clear step by step user case for beginners.
I have just installed into my Win 7 Pro 64-bit SP1 machine SQL Server 2008 R2 Express Database with Advanced Services [downloaded from here http://www.microsoft.com/express/Database/InstallOptions.aspx]. (Actually I have removed and installed it 3 times now to check I'm not missing anything config wise). I have left basically all settings as default, with the exception of calling the Instance SQLEXPRESS (all caps vs default SQLexpress) my last installation I have left set as 'windows authentication mode' with only the same user as I am running now selected (only one user on this machine anyway).
After completion I have restarted the machine, I can see the services
SQL Server (SQLEXPRESS) -> Started -> Automatic
SQL Server Agent (SQLEXPRESS) -> -> Manual
SQL Server Browser -> -> Manual
SQL Server Reporting Service (SQLEXPRESS) -> Started -> Automatic
SQL Server VSS Writer -> Started -> Automatic
.. So it seems to be up OK.
As part of the installation process it also installed SQL Server Management Studio 2008 R2 and when I try and connect I am choosing:
Server: Database Engine
Servername : \SQLEXPRESS
Authentication: Windows Authentication
User name: (selected for me and not alterable) machinename\username
Password: (also blank greyed out)
I hit connect and get the following message.
Cannot connect to \SQLEXPRESS.
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: SQL Network
Interfaces, error: 25 - Connection
string is not valid) (.Net SqlClient
Data Provider)
Error Number: 87
Severity: 20
State: 0
OK, so given I am not entering a username or password, and I'm certain of the server instance name - and that it is running ... what am I doing wrong?
Here are a few troubleshooting tips for connecting to SQL Server via SSMS:
Ensure you're connecting to .\sqlexpress or localhost\sqlexpress, or (local)\sqlexpress. It's not case sensitive. It appears you're missing the hostname in the server name field in the connection dialog.
You're using Windows/AD authentication, so you don't have to enter any credentials. It appears you're all set there.