I have a small application that uses a SQL-Server express 2005 database located on a remote machine. This has worked for years. I've not only been able to access it via the application, but also on the development machine. The other day I came in to the server (windows 7 machine) shut down from a power outage. Since then I have not been able to access the database and receive an error 26. I have checked the firewall and it does indeed have the exception for sqlbrowser and UDP 1434 set. I also checked Configuration Manager and SQL Server (SQLEXPRESS) and SQL Server Browser are both running. (Even did a restart on both)
Client Protocols are enabled for Shared Memory, TCP/IP and Named Pipes.
Here is where it gets strange (At least for me). Both the development machine and the machine that uses the application that works with the database were both set to Obtain IP Address. If I set these to a static address they are then able to access the database without issues. I would like to not have to set static IP's and get things running the way they have for the past couple of years. Does this shed any light on what I might need to check to see why I can no longer access this server without a static IP on the remote machines?
The server is 2007 pro along with the development machine. The remote machine that uses the application is Windows 10 pro.
I should also state that I can browse the network and access normal shares via windows network with and without the static ip from both machines.
EDIT: The exact message I get when I don't use a static ip 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) (Microsoft SQL Server)
I get this error even when trying to connect using Microsoft SQL Server Management Studio Express.
After many installations I learned that opening the SQL Server port in the firewall works always when using the default instance, but with named instances and SQL Browser opening the ports some times doesn't prevent the firewall for blocking connections, specially in small environments that doesn't have a proper server like the one you describe (I think that it's related to the dynamic port feature that SQL Server use by default with named instances, but I'm not sure).
When I have to use named instances instead of opening the ports I create rules for the programs themselves and it has worked fine until now. Create two rules using New rule > Programs > This program path, one for:
C:\Program Files\Microsoft SQL Server\90\Shared\sqlbrowser.exe
and other for:
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\sqlservr.exe (maybe this location is a bit different when using the SQLEXPRESS instance).
I usually create the rules only for private network locations, but maybe you should create the rules for all locations just to be sure (and if this works, try unchecking public locations from the rules).
For future installations note that you can configure Express editions to use the default instance MSSQLSERVER at install time (and only at install time), with that option you just open port 1433 and you are done.
Related
I configured both my development computer and my staging computer to be able to access SQL Server over the local network about one year ago (and everything worked fine until today). Yesterday evening, the head of our support team made some major changes in our physical switches and router equipments.
This morning, I had no internet access anymore on both my computer. What a mess!
We were able to to solve that problem by changing the default gateway (I have static IP configured) on both my computer.
Now I can access my development database server from my staging computer using either: "192.168.1.58\SQLEXPRESS" and "JONATHAN\SQLEXPRESS", but I cannot access my staging development database server from my development computer using: "192.168.1.56\SQLEXPRESS" or "STAGING\SQLEXPRESS".
Still, I can access my staging database server on the computer itself using both ip and named pipe.
That problem kind of bugging me up since both my SQL Server are using the same configurations (note: my development computer works fine without "Named Pipes". Activating it on my staging computer didn't solve the problem.)
Yet, every time I try to connect, I get the following 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: SQL
Network Interfaces, error: 26 - Error Locating Server/Instance
Specified) (.Net SqlClient Data Provider)
Both my SQL Server (SQLEXPRESS) (I log on as "Network Service" as suggested in some threads) and SQL Server Browser services are running (tried to restart them several time) and turned off my firewall.
I can ping my staging computer:
Access the shared file via the network (\\STAGING):
And even access it's phpmyadmin via my browser (http://staging/phpmyadmin/).
I have the feeling I'm missing something obvious, but I can't seem to figure out what. I guess I need some more coffee ha, ha, ha.
Thank you all for your help
I'll write the answer since nobody suggest that on the internet.
When I regain internet/network access on my computer, I selected "work network" on my development computer and "public network" on my staging computer.
After playing some with the physical devices, the tech. who made the change suggested me to check out on which network I was (which was the same network "Network 4" except for being public vs work).
According to http://www.dummies.com/how-to/content/how-to-change-a-network-type-in-windows-7.html :
Windows 7 puts up your PC’s shields. Windows Firewall plugs almost all
its openings and protects its internal programs for being connected to
potentially hostile network.
But it seems to be a little bit more complicated than this since I had completely turned off my firewall on my staging computer. Beware of these additional public protections when configuring your SQL Server.
I have both java and .net applications running on an app server using Microsoft Windows Server 2003, Enterprise Edition. These are being migrated to another app server Windows 2008 64-bit machine.
All applications connect to the same SQL Server 2005 database, on a named instance.
So far I have tried to move the applications exactly as they are, with no changes in the configuration files, from the old box to the new box.
On the new app server, neither the java nor the .net applications connect to the database (named instance).
JDBC error message: "The connection to the named instance has failed. Error: java.net.SocketTimeoutException: Receive timed out."
The .net 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."
If I change the DB config to one that is not on a named instance it works on the new app server.
The database is setup correctly, because we were able to connect on the old app server. I can ping the database server from the new app server.
Is there any reason this won't work on the new app server?
java connection string: "jdbc:microsoft:sqlserver://[dbservername];SelectMethod=Cursor;instanceName=[dbinstance]"
.net connection string: "Server=[dbservername]\[dbinstance];Database=Risk_DB;Uid=[user];Pwd=[pwd];"
UPDATE
Per suggestions in the answers, I got the instance port number. I also installed SQL Server Management Studio so I can eliminate my apps as the problem points. From Management Studio, if I use [servername][instancename], I get the message "a network-related or instance-specific error while establishing a connection to SQL Server..." But it works when i use [servername],[port]. Not sure if there's anyway to work around this?
UPDATE #2 Escalated the issue to the infrastructure/server/network team. They disabled windows firewall on the new app server. Presto, now I can connect to [dbservername]\[dbinstance] in Management Studio, and all apps are working using existing configuration files.
Your named instance is going to be running on a different port. Port 1433 (the default for a default instance) is probably open, and the port that the named instance is running on is probably blocked. You can check the port in the error log for the named instance (assuming you can connect locally, in Object Explorer, expand the server, expand Management, expand SQL Server Logs, right-click current, and choose "View SQL Server Log" IIRC), it will say something like this on startup:
Server is listening on [ 127.0.0.1 <ipv4> 3587 ].
That last number is the port number that needs to be accessible from your remote machine and whatever network devices and services it has to go through to get there. If you don't find a line like that, it's possible that TCP/IP is not enabled for the named instance. On that server, go to SQL Server Configuration Manager, expand SQL Server Network Configuration, click on "Protocols for " and make sure TCP/IP is enabled in the right pane. If you have to enable this you'll need to restart SQL Server for it to take effect.
If it is already enabled (or once you enable it and restart the service), you should be able to refresh this view and validate the port that is being used if you right-click TCP/IP, hit properties, and move to the IP Addresses tab. You can see the ports currently being for each IP. Here there will be multiple IPn sections and an IPAll section. For each IP, you can change the "TCP Port" box to a port you want to use (and delete any values in all the "Dynamic TCP Ports" box to 0). Hit Apply and restart the service. This will again require a restart of the service but will allow you to specify a specific port so you can add an exclusion to your firewall (or make use of one that already exists, assuming this server isn't already using that port).
Possible issues:
Firewall maybe blocking connections.
The instance name is not the same as specified in the connection string.
The connection string specifies a different port or SQL Server is running on a different port rather than the default 1433
We've been experiencing a strange issue with SQL 2008 R2 (10.50.1600) installed as a named instance. In order for any external clients to connect, we have a certain procedure we have to follow, but should not have to. Now I did in fact open the TCP/IP and Named Pipes protocols on the SQL server and restarted it, this isn't the problem. We're on an Active Directory Domain (running from Server 2003). The problem exists no matter what OS the server or client is (XP, 2003, 2008, Vista, 7, 64bit, 32bit, etc.). The problem also persists from anything which can connect, for example, SQL Management Studio, ADO (from our applications), etc.
The problem is that before any client can connect to this server, each client machine must first connect to this server through ODBC (and we don't use ODBC). Any attempt to connect to a 10.5 SQL server before doing this results in "Server does not exist or access denied". But once we can connect in the ODBC (through Named Pipes), then everything else starts to work. The same issue occurs both when using the Computer Name and IP Address. In fact, if we want to connect with computer name \ instance name, then we have to do so first in the ODBC, and then if we want to connect via the IP address \ instance name, then we have to do the same also for that.
We've been having to do this on every single client computer. Again, once the ODBC is able to connect to this SQL server through Named Pipes, then all future attempts from that client work.
What could be causing this to occur? How to avoid it? I should not have to do this "ODBC Trick" as we've been calling it. I've never had this issue on any other version of SQL.
The issue might be related to the SQL Browser service. Each sql instance will have a different port number - try connecting from the client as IP Address,Port (e.g. 123.123.123.1,1433) - this will exclude DNS and Browser from the equation
Edit: now knowing that it is browser related, try see why clients can't access SQL Browser (usually Port 1434). Service not started? Possibly firewall blocking?
Microsoft have tied down everything security wise now by default, so any new configuration now generally requires quite a bit of detailed security planning, policy configuration, permissions etc. Welcome to the age of non-trust ;)
You could easily test your connection by creating a simple file. Follow the steps here at "How to test an SQL Server connection": http://teusje.wordpress.com/2012/02/21/how-to-test-an-sql-server-connection/
I am not able to establish remote connections to SQL Server 2008 enterprise edition.
I have followed and implemented a lot of tutorials available. These are the things i have done:
enabled TCP/IP connections in SQL configuration manager.
added a rule to allow inbound connections at port 1433.
allowed remote connections in the properties window of the concerned instance.
But it still gives the error
I am trying to install samples for replication using AdventuresWorks database and i am not able to install the sample.
here is the error i got
Attempting to create the 'ReplData'
share that replication uses as the
working directory.
A subdirectory or file C:\Program
Files\Microsoft SQL
Server\100\Samples\Replica
tion\ReplData already exists. The name
has already been shared.
More help is available by typing NET
HELPMSG 2118.
HResult 0x274D, Level 16, State 1 TCP
Provider: No connection could be made
because the target machine actively re
fused it.
Sqlcmd: Error: Microsoft SQL Server
Native Client 10.0 : A network-related
or in stance-specific error has
occurred while establishing a
connection to SQL Server . Server is
not found or not accessible. Check if
instance name is correct and i f SQL
Server is configured to allow remote
connections. For more information see
SQL Server Books Online.. Sqlcmd:
Error: Microsoft SQL Server Native
Client 10.0 : Login timeout expired.
The publication was created
successfully. You must create a
virtual directory to use Web
synchronization. If you plan to use a
separate Web server, you must run the
Web Synchronization Wizard on that Web
server. (A certificate that supports
SSL must already be installed.)
Do you want to create a virtual
directory named SalesOrders for Web
synchronization on S2NWORKSTATION?
[y,n]
Start the SQL Management Studio
Connect to the server.
Then choose the server in the Object-Explorer and right-click on properties.
Then check the "connections" settings, there you can/have to allow remote connections for this database server.
Are you connecting to a default instance or named instance? If a named instance, then you you should have the sql browser windows service running. Also ensure that remote connections are allowed (I believe this is a different setting than simply turning on TCP/IP).
One tool that could be helpful is PorQryUI (Port Query), it will test to see if the proper ports are open.
I too, had this problem. I solved by doing a couple of things:
1. Make sure the SQL Browser service is started on my local machine
2. Make sure UDP Port 1434 in the firewall is open for outgoing on the local machine
3. Make sure UDP Port 1434 is open in the firewall for incoming on the remote machine.
The UDP Ports are for the SQL Server Browser. Apparently, Visual Studio uses that to detect that the remote server exists.
This Stack Exchange thread was very helpful to me.
I'm running SQL Server 2008 Express on Windows XP on a VirtualPC instance inside a Windows XP host. I want to be able to connect to databases on the guest instance using SSMS on the host. When I go to connect from SSMS on the host, and browse for servers, I see the instance of SQL Server on the guest. Yet when I try to connect, using a SQL authentication login, I get the following connection 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: 28 - Server doesn't support requested protocol) (Microsoft SQL Server, Error: -1)
I have:
* tried connecting with both Name Pipes and TCP/IP
* ensured that the SQL Browser service is up
* ensured that the firewall on the guest is open
* the server is configured to allow remote connections (according to the database engine properties within SSMS on the guest)
What am I missing?
EDIT: I figured this out. My resolution is below.
SELF-ACCEPTED ANSWER
Thanks for the ideas. After much fiddling I got things working. It turned out that I had not gone into the Sql Server Configuration Manager and enabled TCP/IP and Named Pipes as network protocols. So even though SSMS said remote connections were enabled, there was no protocol to allow for them other than shared memory. After I did this I restarted the SQL Server service, but things still didn't seem to work properly. Yet once I had rebooted both the guest and host, everything was working as expected.
How are your IP settings? Are you sharing the same IP address between the two machines? If so, then perhaps when your clients attempt to connect to 10.1.1.10, it is hitting the IP of the machine hosting the VPC instance, and that machine is not running the SQL Server instance. If possible, have VPC get its own IP and try that.
Mostly double check what you have already said,
turn off the guest firewall to make sure it isn't that.
Make sure your virtual machine networking is set to bridged and not NAT.
Try connecting to the IP address of the guest instead of its name.
Make sure the remote connections are allowed by SQL server and that both client and server are using tcp/ip (or named pipes if you prefer).
I don't know if enabling remote connections requires a restart of SQL server.
Try using SQL authentication to eliminate an authentication issue. Are you running on a domain?
To add some steps that are not explicitly called out above, what worked in my experience was to set up the Virtual PC's Networking to my physical network adapter.
Then disabled Windows Firewall for the Public Profile.
Hopefully could actually lock that down to port 1433.
Also, on the guest OS, if SQL Server is installed with only Windows Auth, you later add SQL auth, note that by default 'sa' is disabled for login access. Either 'enable' Login for 'sa' or (better idea) create Logins with appropriate permissions as needed.