One machine on network cannot connect to SQL 2005 - sql

I've got a small Windows network with 3 machines. One of them has SQL 2005 installed. As of last week, the other two machines have had no problems connecting to the SQL instance.
Today, one machine - running Vista, if that matters - all of a sudden cannot connect. I get the generic message saying "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."
I'm pretty sure everything is set up correctly on the SQL 2005 box, because the third computer on the network still connects with no problem.
Vista computer has no firewalls set up, nothing has changed with the exception that I created a connection to a VPN a few days ago. When connected to the VPN, local network connectivity is hosed, but I've double checked many times that I am NOT connected to the VPN when trying to access SQL Server. I mention this only because it's the only thing I can think of that's changed.
I've rebooted all computers many times. No change.
I'm connecting via SQL Integrated Security. The login works fine from the third machine.
One other weird thing on the Vista box. Occasionally - maybe 5% of the time - it'll connect, but then when trying to access a table (like, just right clicking and choosing "open") it pauses then gives an "unspecified error."
Any ideas? I'm totally perplexed. This has been working for about 18 months without any errors, and I can't think of anything that's changed other than the VPN connection mentioned above. And just to reiterate - I am definitely NOT connected to the VPN when I'm getting this error.

Check the protocols used to connect ot SQL Server; I'm wondering whether it's trying to communicate over Named Pipes rather than TCP/IP (speaking from recent experience -- I had an issue with Named Pipes that went away when I disabled Named Pipes and enabled TCP/IP).
You can check this on the server with the SQL Server Configuration Tool, and see which protocols are enabled (under the Network Configuration branch in the navigation tree) for the SQL Server instance.

First off, we know that there is no client server communication here. So, based on the error, it isn't permissions or authentication (you have to connect before you can be denied access).
Try the following:
1) Ping - can you get to the server? Run this command in command prompt:
ping servername
If this works, then at least the name is resolving and the client can communicate.
If this fails, try the same thing with the server's IP.
2) Telnet - Assuming you don't have a non-standard port (explicitly changed or named instance of SQL Server), run this in command prompt:
telnet servername 1433
If this opens an empty screen, then the client can get to the port.
If this fails, try the same command with the IP. If that still fails, you don't have a path to the SQL Server from that machine. You will either need to verify an external firewall or other network connectivity issues.

Related

Cannot connect to remote SQL server

A client of mine gave me a server name which is fully qualified [servername].somedomain.net
to try to connect to their SQL Server instance over VPN.
So I tried, using the username and password they gave me. No luck. I can ping it but cannot connect, I get the error that the username and password is incorrect.
So I log onto the actual server, verify that my login is in security and has rights and it appears there. Workgroup\mylogin and it appears that workgroup\ actually is the same as somedomain.net\mylogin. Because when I try to add somedomain.net\mylogin, it resorts to saying that it's already added which is workgroup\mylogin.
Not sure what else to check here. I gave myself sysadmin role in SQL Server. I can ping the server's IP.
I looked at how they are authenticating me and they have my user in SQL Server set up to use Windows Auth. Well, the error I get is that it cannot trust cross domain when trying to use windows auth when I try to connect locally here in my management studio. I'm connected tot their VPN so what could be the problem?
They're not available right now to try to troubleshoot it and I'm just curious what else I might try to try and resolve this on my own if I can.
Basically, when you failed to connect to your SQL Server, the issue could be:
Network issue,
SQL Server configuration issue.
Firewall issue
Client driver issue
Application configuration issue.
Authentication and logon issue.
Step 1: Network issue
You might be able to make local connection without a working network, but that's a special case. For remote connection, a stable network is required. The first thing to trouble shoot SQL connectivity issues is to make sure the network we rely on is workable and stable. Please run the following commands:
ping -a (use -4 and -6 for IPv4 and IPv6 specifically)
ping -a
nslookup (type your local and remote machine name and IP address multiple times)
Be careful to see any mismatch on the returned results. If you are not able to ping your target machine, it has high chance that either the network is broken or the target machine is not running. It's possible the target machine is behind a firewall and the firewall blocks the packets sent by ping, though. Windows firewall does not block ping (ECHO) packet by default. The correctness of DNS configuration on the network is vital to SQL connection. Wrong DNS entry could cause of all sorts of connectivity issue later. See this link for example, "Cannot Generate SSPI Context" error message, Poisoned DNS.
Step 2: SQL Server configuration issue
You need to make sure the target SQL Server is running and is listening on appropriate protocols. You can use SQL Server Configuration Manager (SCM) to enable protocols on the server machine. SQL Server supports Shared Memory, Named Pipes, and TCP protocols (and VIA which needs special hardware and is rarely used). For remote connection, NP and/or TCP protocols must be enabled. Once you enabled protocols in SCM, please make sure restart the SQL Server.
You can open errorlog file to see if the server is successfully listening on any of the protocol. The location of errorlog file is usually under:
%ProgramFile%Microsoft SQL Server/MSSQLxx.xxx/MSSQL/Log
If the target SQL instance is a named instance, you also need to make sure SQL Browser is running on the target machine. If you are not able to access the remote SQL Server, please ask your admin to make sure all these happen.
Step 3: Firewall issue
A firewall on the SQL Server machine (or anywhere between client and server) could block SQL connection request. An easy way to isolate if this is a firewall issue is to turn off firewall for a short time if you can. Long term solution is to put exception for SQL Server and SQL Browser.
For NP protocol, please make sure file sharing is in firewall exception list. Both file sharing and NP use SMB protocol underneath.
For TCP protocol, you need put the TCP port on which the SQL Server listens on into exception.
For SQL Browser, please put UDP port 1434 into exception.
Meanwhile, you can put sqlservr.exe and sqlbrowser.exe into exception as well, but this is not recommended. IPSec between machines that we are not trusted could also block some packets. Note that firewall should never be an issue for local connections.
Step 4: Client driver issue
At this stage, you can test your connection using some tools. The tests need to be done on client machine for sure.
First try:
telnet
You should be able to telnet to the SQL server TCP port if TCP is enabled. Otherwise, go back to check steps 1-3. Then, use OSQL, SQLCMD, and SQL Management Studio to test sql connections. If you don't have those tools, please download SQL Express from Microsoft and you can get those tools for free.
OSQL (the one shipped with SQL Server 2000) uses MDAC.
OSQL (the one shipped with SQL Server 2005 & 2008) uses SNAC ODBC.
SQLCMD (shipped with SQL Server 2005 & 2008) uses SNAC OLEDB.
SQL Management Studio (shipped with SQL Server 2005 & 2008) uses SQLClient.
Possilbe command use be:
osql -E -SYour_target_machine\Your_instance for Windows Auth
osql -Uyour_user -SYour_target_machine\Your_instance for SQL Auth
SQLCMD also applies here. In addition, you can use “-Stcp:Your_target_machine, Tcp_port” for TCP, “-Snp:Your_target_machine\Your_instance” for NP, and “-Slpc:Your_target_machine\Your_instance” for Shared Memory. You would know if it fails for all protocols or just some specific procotols.
At this stage, you should not see general error message such as error 26 and error 40 anymore. If you are using NP and you still see error 40 (Named Pipes Provider: Could not open a connection to SQL Server), please try the following steps:
a) Open a file share on your server machine.
b) Run “net view \your_target_machine” and “net use \your_target_machine\your_share” (You can try Map Network Drive from Windows Explorer as well)
If you get failure in b), it's very likely you have OS/Network configuration issue, which is not SQL Server specific. Please search on internet to resolve this issue first.
You can try connection using both Windows Authentication and SQL Authentication. If the tests with all tools failed, there is a good chance that steps 1-3 were not set correctly, unless the failure is logon-related then you can look at step 6.
If you succeeds with some of the tools, but fails with other tools, it's probably a driver issue. You can post a question on our forum and give us the details.
You can also use “\windows\system32\odbcad32.exe” (which ships with Windows) to test connection by adding new DSN for various drivers, but that's for ODBC only.
Step 5: Application issue
If you succeed with steps 1-4 but still see failure in your application, it's likely a configuration issue in your application. Think about couple of possible issues here.
a) Is your application running under the same account with the account you did tests in step 4? If not, you might want to try testing in step 4 under that account or change to a workable service account for your application if possible.
b) Which SQL driver does your app use?
c) What's your connection string? Is the connection string compatible to your driver? Please check http://www.connectionstrings.com/ for reference.
Step 6: Authentication and logon issue
This is probably the most difficult part for sql connectivity issues. It's often related to the configuration on your network, your OS and your SQL Server database. There is no simple solution for this, and we have to solve it case by case. There are already several blogs in sql_protocols talking about some special cases and you can check them see if any of them applies to your case. Apart from that, things to keep in mind:
a) If you use SQL auth, mixed authentication must be enabled. Check this page for reference http://msdn.microsoft.com/en-us/library/ms188670.aspx
b) Make sure your login account has access permission on the database you used during login ("Initial Catalog" in OLEDB).
c) Check the eventlog on your system see if there is more information
Reference: http://blogs.msdn.com/b/sql_protocols/archive/2008/04/30/steps-to-troubleshoot-connectivity-issues.aspx
Sorry for this wall of text, i hope that something from here can help you solve your issue!
Regards.
If you want to access that server you are going to need a domain account from that domain or use SQL authentication. I would recommend just using SQL authentication - it's a lot more straight forward - if they allow it.
I had the same problem, other machines could connect to sql server but one computer was not connecting and displaying the error "a network related or instance specific error...", the problem was solved when I changed the network protocol in the login window of SSMS, in advanced options from TCP/IP to Named Pipes. Please see the below screenshots.
Please note that you should be on the same domain, and your credentials should be valid on the server.

Connecting to my remote SqlServer database

Im currently making a wpf Windows Application, and it withdraws data from a database, so it is needed that I setup a connection to my remote servers SQL Server Database. Now i am getting a couple errors. When I first of all try to connect to my remote servers Sql Server using management studio, just to test if I could actually make a connection, I get the following error.
A connection was successfully established with the server, but then an error occured during the login process. (provider: Named Pipes Provider, error: 0 - No process is on the other end of the pipe.)
(Microsoft SQL Server, Error: 233)
And ovcourse, I did try my best to do my research, and I found out a few things talking about allowing the SqlBrowser in firewall properties, done that...
allowing a connection to port 1433 and port 1434 through windows firewall, done that both.
Is there something Im missing or not doing?
Also it says "a connection was succcessfully established with the server" which means that It is able to connect, but something is going wrong somewhere. Also where it says "error occured during login process" could it simply mean I entered the wrong credentials?
I mean, when installing the SQLExpress I chose Windows Authentication so I never really got a username and password, So i just used the username and password for the Administrator account I use to connect to my server itself. Dont know It could have something to maybe just do with my login.
Could anyone please point me in the right direction as to why Im getting that error, even though I have enabled the TCP Connections and allowed SqlBrowser.
Any help would be greatly appreciated.
Thanks.
This is a bad certificate-related error, probably caused by different operating systems/environmental differences. If this is for testing purposes I'd disable the certificate, or you can configure it here (which is probably a good idea if you're creating a real application and not just playing around with it).
Please run the sql service and agent service by creating new id and start the service with that like ea admin or any other.
The port error will continue to show even if you fix the port ,check telnet configuration and enabled/open port via it.
I had similar problems so i created a virtual server installed sql server2008 r2 and then started it worked fine.
There are possibilities of error and authentication problems since we reuse the server by formatting it .

User can't connect to a SQL Server

I have an WinForms app in the enterprise, which makes a connection to a SQL Server 2008 box. A lone user can't seem to make a connection. He brings his laptop and plugs it into the network. The laptop is not joined to the domain, but the connection to the SQL Server is not through Windows authentication.
I can ping the SQL Server from his laptop. I tried creating a UDL file and connecting and that does not work either. The error:
Test connection failed because of an error in initializing provider.
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or
access denied.
Here are facts:
The user can connect to any other SQL Server on the network.
No other user (on the domain or not) has this issue.
I had the user VPN into the network, with same results.
I tried connecting my personal laptop (not on the domain, but attached to the office network) and was able to connect with no problems.
I VPNed from home into the network and was able to connect with no issues.
What else can I do to troubleshoot the connectivity issue?
I got the same issue. Tried to check network connection, port, firewall, etc but no use.
Finally, I realized the top order of Default Document was not default.aspx. After I changed the it on the top, it worked.

Unable to connect to SQL Express "Error: 26-Error Locating Server/Instance Specified)

I am at an loose end with one particular box that is running SQL Server 2008 R2 Express.
Windows Firewall is configured to allow inbound TCP & UDP 1433, 1434.
Windows Firewall is configured to allow outbound TCP & UDP on any port.
No other software AV/FW is currently running.
When I try to connect to xxx.xxx.xxx.xxx\sqlexpress, it times out with the following error:
TITLE: Connect to Server
Cannot connect to xxx.xxx.xxx.xxx\SQLEXPRESS.
ADDITIONAL INFORMATION:
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) (Microsoft SQL Server, Error: -1)
I have checked that remote connections are allowed on the server.
I have confirmed TCP/IP is enabled and configured in SQL Server Configuration to allow connections on the external IP to 1433.
I have also used Wireshark from my local machine and I can see requests for 1433 UDP going to the remote server.
But using Wireshark on the remote server shows no inbound connection requests for 1433 UDP or anything from my external IP (with filtering to remote RDP from results).
This makes me think it is a firewall issue.
The server is hosted by an external company who have control over the PIX in front of our server.
I need to troubleshoot this as much as possible myself as the hosting company have no clue what they are doing.
I had a similar problem which was solved by going to the "SQL Server Configuration Manager" and making sure that the "SQL Server Browser" was configured to start automatically and was started.
I came across this solution in the answer of this forum post:
http://social.msdn.microsoft.com/Forums/en-US/sqlexpress/thread/8cdc71eb-6929-4ae8-a5a8-c1f461bd61b4/
I hope this helps somebody out there.
press windows+R open RUN Window
services.msc
find SQL Server(SQLEXPRESS) right click on that and start the service
then check
Go to SQL Server Configuration Manager > SQL Server Services > In Right Side window show all the servers which may stop. If you are using "SQLEXPRESS" then ,
Right click on SQL Server(SQLEXPRESS) and start. After try to connect server... I had same problem but I resolved by these steps.
Here is a simple method to troubleshoot connection issues:
Create an empty file called test.udl using a text editor
Double click the file test.udl, then specify your connection properties
Hit the "Test Connection" button.
I recently encountered the same issue however I am using Windows 10 Technical Preview Build 10041 and SQL Server 2014 (Advanced).
Follow the same advice from above:
In particular, my problem was that I did not enable the TCP/IP in Sql
Server Configuration Manager->SQL Server Network
Configuration->Protocols for SQLEXPRESS.
Once you open it, you have to go to the IP Addresses tab and for me,
changing IPAll to TCP port 1433 and deleting the TCP Dynamic Ports
value worked.
Follow the other steps to make sure 1433 is listening (Use netstat -an
to make sure 0.0.0.0:1433 is LISTENING.), and that you can telnet to
the port from the client machine.
Finally, I second the suggestion to remove the \SQLEXPRESS from the
connection.
AND ----> That last line is important! It looks like to be Windows 10 specific; remove \SQLEXPRESS from your connection string. What was frusting was that SQL Management Studio connects just fine using either connection string (full or short), however Visual Studio only accepted the connection string without the \SQLEXPRESS.
The active firewall on the server might be causing this. You can try to (temporarily) turn it off and see if it resolves the issue.
If it is indeed caused by the firewall, you should allegedly be able to resolve it by adding an inbound rule for TCP port 1433 set to allowed, but I personally haven't been able to connect this way.
I had a Same Problem but i solved by Restarting the browser service in SQL CONFIGURATION MANAGER and removing \SQLEXPRESS from the instance name in the connection window.
It's security all about. Make sure you have double check your firewall (windows and anti virus) in some cases when you disabled av firewall and restart your computer, automatically windows firewall is active and it's still block your application. Hope this is helpful ..
Could you post the connection string you're using that's giving you trouble?
You might need to add the port number to the Data Source value, as omitting it can also produce SQL Error 26.
E.g.: Data Source=ServerHostName\SQLServerInstanceName,1433
If you have done anything but in spite of all couldn't connecting?!!
In my case i have changed connection part splitting port "," instead of this ":"
The corresponding TCP port or pipe name is not specified in the connection string (such as Srv1\SQL2008, 1433).
This issue also confused me a few days, after the IT guy changed some security settings on the SQL Server.
I have an EntityFramework for the Web application and for a desktop application.
After I changed some settings on the SQL Server, the Web application comeback to work, but the desktop still facing issue. But I used the same connection string for both applications, it make no sense one is working but the other doesn't.
Then I searched a lot until I found someone saying here it is needed to add port number 1433 after the $ServerName\$DatabaseInstanceName,1433.
After I added it, the exception became:
System.Data.SqlClient.SqlException: Login failed for user
'domain\name-PC$'
Then I found this link. It says to add Trusted_Connection=False;.
The whole connection string should be like:
data source=XXXXX\SQLSERVER,1433;initial catalog=XXXDB;user id=UserID;password=PWD;Trusted_Connection=False;MultipleActiveResultSets=True;
Hope this answer will help the ones out off Generic exception:
Error: 26-Error Locating Server/Instance Specified
Have you Disabled the VIA setting in the SQL configuration manager? If not, do disable it first (if VIA is enabled, you cannot get connected) and yes TCP must be enabled. Give it a try and it should be working fine.
Make the changes only for that's particular instance name.
Cheers!
I found this url to be very useful:
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/2cdcab2e-ea49-4fd5-b2b8-13824ab4619b/help-server-not-listening-on-1433
In particular, my problem was that I did not enable the TCP/IP in Sql Server Configuration Manager->SQL Server Network Configuration->Protocols for SQLEXPRESS.
Once you open it, you have to go to the IP Addresses tab and for me, changing IPAll to TCP port 1433 and deleting the TCP Dynamic Ports value worked.
Follow the other steps to make sure 1433 is listening (Use netstat -an to make sure 0.0.0.0:1433 is LISTENING.), and that you can telnet to the port from the client machine.
Finally, I second the suggestion to remove the \SQLEXPRESS from the connection.
EDIT: I should note I am using SQL Server 2014 Express.
This really Works .. i had verified lot of sites and finally got the answer
This may occurs when the master.mdf or the mastlog.ldf gets corrupt . In order to solve the issue goto the following path
C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL , there you will find a folder ” Template Data ” , copy the master.mdf and mastlog.ldf and replace it in
C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA folder .
Thats it . Now start the MS SQL service and you are done .
While there can be many reasons for this error - In my case it was pretty simple which I overlooked for a while. I was using server IP address along with instance name for Server as -
<add name="MyDBConnection"
connectionString="Persist Security Info=False;User ID=sa;Password=xxx;Database=MyDB;Server=nn.nn.n.nn\SQLInstance01; Connection Timeout=180" providerName="System.Data.SqlClient"/>
Correct connection string will look something like this (note this one doesn't have SQL Server instance name)
<add name="MyDBConnection"
connectionString="Persist Security Info=False;User ID=sa;Password=xxx;Database=MyDB;Server=nn.nn.n.nn; Connection Timeout=180" providerName="System.Data.SqlClient"/>
HTH.
In my case, I Installed SQL Express 2012 and the problem raise after I reboot my PC. I solved so:
I go to Services -> SQL Server (SQLEXPRESS) and I see that was stopped. I started and It's say an login error.
In properties, Tab Log On, I change it to Local System account , then I can start the SQL service.
Then to test it, I go to SQL Server Management Studio and I connect to .\SQLEXPRESS and it works!
I had a similar problem which was solved by going to the "SQL Server Configuration Manager" and making sure that the "SQL Server Browser" was configured to start automatically and was started.
it works for me
I got a similar problem with sql server , I have tried every thing but does not connect to database engine & it shows error:26.
First check if the database engine is running or not. by going into
configuration manager. start > sql server >sql server configuration
manager. On the right pane you should see the sql server (mss .. )
should be running state with a green indication.
IF the database engine is not running, simply uninstall sql
server / format your system if possible and then download sql
server 2012 and management studio. from
https://www.microsoft.com/en-ca/download/details.aspx?id=29062
Install server first, make sure to add server on installation phase
by clicking add server and then install management studio.
All you need to do is to go to the control panel > Computer Management > Services
and manually start the SQL express or SQL server.
It worked for me.
Good luck.

sql server connection error

I keep getting the following error when I try to register a db server:
TITLE: Connect to Server
Cannot connect to p3swhsql-v14.shr.phx3.secureserver.net.
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: 3)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=3&LinkId=20476
BUTTONS:
OK
I googled, but most of the solutions are related to checking stuff on the sql server. It
s a shared server and I don't have access to the machine. I tried to register another db server and I get the same error. I know the connection properties are correct. I am not sure what else I can do. Btw, the windows firewall on my local machine is disabled.
There is a similar thread with some suggestions at: Getting a sql connection error when trying to login.
Other possible issues could be a firewall on the server side that is only allowing connections from a certain IP range. Even if your own firewall is off, that doesn't mean the server's firewall is letting your machine through. Did the server admin open up a hole for your home machine?
If the server isn't set up to receive remote connections and you can't edit the server, I'm not sure that there's much you can do. You can't connect to a remote database if it doesn't want you to, and for good reason.
Many times, you can also be limited to just one IP or range of IPs, so it won't work from multiple locations. Again, this is something to set on the server, so you'd need to check with your provider.
This error was due to the office firewall. If I connect to another VPN, everything works fine. Whilst doing research on google, I came across something perhaps it could be useful to somebody else.Go to the registry editor:
HKEY_Local_Machine > software > Microsoft > MSSQLServer > Client > SuperSocketNetLib . The protocolOrder in my instance was set to start with np tcp and so on. You can modify the order so that tcp :: port 1433 is used before trying to connect via named pipes.'
Check out this link.
It was very helpfull. Just follow few steps and u will get to know the solution
http://techpint.com/programming/error-26-%E2%80%93-error-locating-serverinstance-specified-sql-server