"Error locating server" - SQL Server 2014 - sql-server

I have a problem trying to connect to a SQL Server.
I tried using IP address or name of the server on my connection string but I still get an "Error Locating Server".
I enabled TCP/IP on the server and restart it, but no good results.
My actual connection string is : Server=POSTESERVEUR-PC\SQLEXPRESS;Integrated Security=false;Database=****;User ID=****;Password=****;
The error is :
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)
I have always read a lot of answers to similar problems, but I still don't get what I'm doing wrong.
The SQL Service is running, TCP/IP is listening, and I can ping the server via CMD, the user ID works too, so what is wrong ?
All ideas are welcome. Thanks.

You need to check some steps.
Make sure your server name is correct, e.g., no typo on the name.
Make sure your instance name is correct and there is actually such an instance on your target machine. [Update: Some application converts \ to . If you are not sure about your application, please try both ServerInstance and Server\Instance in your connection string]
Make sure the server machine is reachable, e.g, DNS can be resolve correctly, you are able to ping the server (not always true).
Make sure SQL Browser service is running on the server.
If firewall is enabled on the server, you need to put sqlbrowser.exe and/or UDP port 1434 into exception.
Make sure the Remote Connections enabled on SQL Server – Ensure SQL Server is allowed for remote connections(Server properties/connection/allow remote connection to this server)

Related

Cannot connect to local SQL Server database from a different computer

I get this error:
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 Specific) (Microsoft SQL Server)
I am trying to allow remote access to my local SQL Server database when the user is using my application on a different computer. I've been trying different approaches for weeks and nothing seems to work.
Here is a list of things that I have tried to do:
Changed server property settings to Allow remote connections to the server
Enable TCP/IP and listed 1433 port number in IPALL field
Created inbound rule for SQL Server program, SQL Browser, and port 1433
Temporarily disabled Windows firewall
Again, I know there is a lot of information surrounding this issue, but I feel like I've implemented every solution I could find and nothing is working.
Thank you in advance for your help!
Regarding #1, the allow remote connections to this server checkbox in SSMS does not actually allow remote client clients to connect despite the misleading name. Use SQL Server Configuration Manager (e.g. C:\Windows\SysWOW64\SQLServerManager15.msc, depending on your SQL version) instead. Right-click on SQL Server Network Configuration-->Protocols-->TCP/IP, select Enable, and restart the SQL Server service.

Can't Connect to SQL Server Remotely (TCP Error)

I am having an issue connecting to my SQL Server Database remotely from another computer.
I am trying to connect to the database using a VB.Net application that is suppose to be able to interact with it. I'd say my connection string may be the issue, but I have no problem connecting on the machine the database is on using the connection string.
This is what the connection string looks like though:
"Data Source=[IP_ADDRESS],[PORT];Network Library=DBMSSOCN;Initial Catalog=SQL_Database;Persist Security Info=True;User ID=[USER];Password=[PASS]"
The error I am getting right now is:
Database Error: 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: TCP Provider. error: 0 - The wait operation timed out.).
This is what I have done so far to try to get this to work:
I have made sure that the files being run are on not a network/shared drive.
I've added an exception for TCP Port 1433 and UDP Port 1434 as Incoming Rules to the Firewall.
I've tried disabling the firewall.
I have gone into SQL Server Configuration Manager to ensured that the TCP settings are setup properly.
One thing I am not sure about, is that in the Configuration Manager, I have both the SQL Server and SQL Server Browser running, but the SQL Server Agent is unable to start. Would this cause me my problem?
If not, what else could be my issue? I need to be able to access this database remotely, but the connection string seems to only work locally.
So the issue was literally my company's installed network Firewall. Apparently when I asked if the firewall had been put down for me to test this, "Yes" really meant "No". Once I got the firewall temporarily disabled I was able to connect to everything perfectly fine.

SQL Server Alias stopped working

I have configured a SQL Server 2016 alias following this post and it was working, but suddenly it stopped working.
Error message:
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: TCP Provider, error: 0 - The wait operation timed out.) (.Net SqlClient Data Provider)
I created the alias using the SQL Server Configuration Manager and created it in the 32 and 64bit:
When I go to the Protocols for SQL Server Express, all of them are enabled, thus TCP/IP is enabled. Also, the SQL Server Browser service is running.
Looking at the system log there is no relevant message about it, so I'm a bit lost about what could be causing it to stop working. My OS is Windows 10 Pro.
Would you have any clues to help me solve it? Thanks for any help
Check that the SQLEXPRESS instance's port number hasn't changed, which is likely after a reboot or service restart.
Regarding the use of instance aliases, this is pretty much useless if you're also using dynamic ports for this very reason. To me it's more cumbersome to maintain this configuration than it is to maintain a connection string in your program IMHO.

SQL Server port forwarding

I forwarded port 1433 to 9082 on my server, at firewall set to allow for inbound and outbound, at SQL Server Allow Remote is ON.
But, I can't connect to my SQL Server from client.
I installed SQL Server 2012.
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)
Solution to problems connecting to MS SQL server with Microsoft SQL Server Management Studio if your port is forwarded
I had problem with this as well. It's been bugging me for days now. Finally I stumbled on solution on this page so I'll exclude it as screenshot:
It's not : like in all other systems, you have to put ,
First off check in the ERRORLOG the port used by SQL Server (there is no guarantee it will always listen on 1433, or if TCP is enabled at all).
In the ERRORLOG, at startup, you will find a line like this one:
In my case the port is indeed 1433 but yours may be different. If needed, you can change it using the SQL Server Configuration Manager.
Secondly, if you are forwarding a port to a different one (like your example from 1433 to 9082) you are in fact disabling the SQL Server Browser. This happens because SQL Server Browser does not know of your port forward so it will tell the clients to connect to 1433 (supposing you are allowing UDP 1434 otherwise you won't be able to reach SQL Server Browser at all).
You can connect to a SQL Instance without using the SQL Server Browser though, all you need is to specify the port in the connection string (without the instance name, if any).
For example, if your instance is called MYSERVER/INST your connection string will be something like:
User ID=*****;Password=*****;server=tcp:MYSERVER,9082
Also make sure to configure your SPNs manually otherwise Kerberos won't work.
You can find more details on how to compose the right connection string here: SqlConnection.ConnectionString Property.
try config your router first. after all connect. Btw, already enable TCP/IP #sql yet or not?make sure open port for sql.
check on sql configuration enable or not for open connection
check firewall open or not
check router open or not
check connection lag or not(if network). local no need
make sure sql browser and agent run(for xp if not xp just enable sql browser)
if not all there maybe you wrong installation. if for network work install local/system. not network(this for attach #server cluster)

Cannot connect to local instance of SQL Server Epxress after upgrading from Windows 7 to Windows 10

The title pretty much says it all, however let me tell you what I have researched.
I have verified that the following services ARE running ...
SQL Server (SQLEXPRESS)
SQL Server Browser
SQL Server VSS Writer
(I don't really know what this one does)
This one however will not start ... For some reason it starts then automatically turns off.
SQL Server Agent (SQLEXPRESS)
When I try to connect using my server_name\instance and Windows Authentication I get the following error ...
"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)"
The connection specified in the "Connect to Server" box was working perfectly fine before I upgraded. I thought it might have been my Norton 360 Premier but I uninstalled it and it didn't help. I AM having issues with the adapter frequently dropping the internet connection but I just disconnect and reconnect and that resolves itself ... perhaps it's related?
The other technique I tried was to replace the server name with the IP address ... 192.168.0.22\Instance ... This actually seemed to find the SQL Server but rejected the Windows Authentication ...
"Login failed. The login is from an untrusted domain and cannot be used with Windows authentication."
Any help getting this up and running would be greatly appreciated. I have several databases on here and would hate to have to reinstall SQL Server and manually hook them back up .. or worse lose any of them. I have a client waiting so ... the sooner I get help the MORE appreciative I'll be!!
Sincerely,
G
UPDATE
I have access! But I am not sure what I did that made the difference.
Open SQL Server Configuration Manager.
Expand SQL Native Client 11.0 Configuration (32-bit)
Select "Aliases"
Choose alias name ".\SQLEXPRESS"
Change alias name to "192.168.0.2\SQLEXPRESS" (using your IP address)
Change the value of "Server" to 192.168.0.2\SQLEXPRESS (using your IP address)
This allowed me to log on to the server using the ".\SQLEXPRESS" alias.
Some things I do NOT understand however is ...
I changed the "alias name" expecting that to appear in my list of connections drop down in SQL Management Studio. It did not, but the alias "'\SQLEXPRESS" was still there and worked!
For the alias "SERVER\SQLEXPRESS" I changed the "Server" value to use the IP address as well but received the authentication error described earlier, even though the only difference was the Alias Name.

Resources