I'm getting SQL error 40 when I try to connect to remote SQL using SQL management studio from my local system. It connects without any error when I switch my wifi to another network but it shows SQL error 40 from my office internet connection. I used to connect earlier from the office too. I've checked multiple networks and it throws the same connection error 40 on some other internet connections too. I've tried using the IP address instead of domain name on those networks but no luck. I've also checked the port on firewall, TCP IP, Named pipes everything is up to the mark. Any help would be highly appreciated.
Error on some internet connection:
Connects fine from other internet connection:
This sounds like a routing or Firewall issue on the troublesome network. It may possibly something to do with a dynamic IP address if it worked earlier on that network.
You need to speak to whoever manages the network on which you are getting the error and ask them to investigate.
Related
I have a domain with 10+ clients. The server was rebooted recently, and upon reboot, two of the clients are receiving an error when attempting to access the SQL Server. The clients are running Win7 64bit with MS Office 2013 32bit. All the other computers have no issue.
The MS Access database uses linked tables to connect to the SQL Server 2008 R2 using Trusted Authentication. When opening the Access database, Access hangs for about 30 seconds before showing this error message:
Connection Failed; SQLState: 'S1T00'; SQL Server Error: 0;
[Microsoft][ODBC SQL Server Driver]Login Timeout Expired
When I click OK to clear the error, the SQL Login prompt appears. The server address is already entered, and we use a Trusted connection. Without changing any of the settings I click OK to the login prompt, and it connects to the database successfully.
Sites discussing the same problem (but without a solution that has worked for me):
SQLServerCentral -- Database Journal
(I'm limited by reputation and can't post additional links, but I also found a Google Groups post suggesting resetting Winsock. Another post on SQLServerCentral (Topic1245190-391-1) describes the same issue but has no clear solution)
What I Have Tried:
netsh winsock reset
netsh int ip reset resetlog.txt
netsh int ipv4 reset
sfc /scannow
Restarting the client computer
Run msaccess.exe as administrator
Confirm connection strings use server IP, not server name
Any help is appreciated!
I just ran into this problem. It's exactly as you posted. Access works locally on the same server as SQL, but on remote machines gave the S1T00 error. The problem was with the firewall. Needed to open port 1433.
I have been having troubles to establish database connection using the MS SQL Management Studio. It was working fine when I was using a local internet service provider. However, when I began to use the university internet, I am not able to connect to the db, although I sql-whitelist the ip. I have no ideas how to manage this issue. I have to connect to the db to manage it, but I am receiving "A network-related or instance-specific error occurred while establishing a connection to SQL Server..." Do you have any idea? Is this something that my hosting company should figure out?
Thanks!
There is a reasonably good chance you are being blocked by a firewall at the university. They probably block/allow based on IP. Universities should not allow all IP's in the University net to have access by default.
You may have had a firewall exception for the old address. You can check if port is blocked by using the telnet command from any windows client command line.
telnet 127.0.0.1 1433 -- substitute your sql server ip address or name
telnet 127.0.0.1 22334 -- no reason for the this port to be open
This is what a blocked port looks like
C:\>telnet localhost 22334
Connecting To localhost...Could not open connection to the host, on port 22334:
Connect failed
C:\>
If 1433 is open and associate with ms-sql you get a different behavior (although it is pretty odd) -- you may have to close the command prompt or kill the telnet process. In any case, this confirms the port is open or closed. If port is open and you can't connect, you have a connection string problem or something obscure.
I have two web servers that each run an identical ASP application. These web servers connect to the same SQL server. One of the servers is running the application fine, but the other is throwing 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: 28 - Server doesn't support requested protocol)
I did a wireshark capture on both of traffic in between the web server and the sql server. On the working server, the traffic is using TCP. On the nonworking server, I see alot of UDP traffic, which SQL server doesn't support (makes sense given the error message). Where is the protocol used determined? The applications on each server are identical, so it can't be an application level config issue. I am not a network guy so I am at a loss
Thanks,
Joseph
You can set the "network protocol" in the connection string.
It's worth a try.
Connect via an IP address
Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;
That connection string is not complete, I'm showing the relevant portions.
That sample comes from
http://www.connectionstrings.com/sql-server-2008
This article is old, but will explain the Network Library options.
http://support.microsoft.com/kb/238949
The 2 most common (in my experience) are:
dbnmpntw - Win32 Named Pipes
dbmssocn - Win32 Winsock TCP/IP
EDIT
The other trick is to install PortQryUI, and place this small utility on the "client" machine.......and "poke" the Sql Server, and make sure you get the same results.
http://www.microsoft.com/en-us/download/details.aspx?id=24009
This will help identify any firewall issues...OUTSIDE of using sql server clients.
I'm new to SQL related matters so please bare with my lack of knowledge and asking a question which has been asked countless times before.
I have to connect to a SQL database server which is located at a remote location at xxx.xx.xxx.xx:3306, but every time I try to connect I get the same 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 - No connection could be made because the target machine actively refused it.)"
I get this same error whether I try to connect using SQL Server Management Studio or in a C# program via:
SqlConnection myConnection = new SqlConnection(...)
myConnection.Open();
I've tried it on two different computers, both on the same home network. I've had a look at the SQL server configuration manager on the computer which I installed SQL Server on, enabling TCP/IP and fiddling with the port values settings, but I'm guessing this is just for configuring an SQL server on my computer and irrelevant to connecting to a remote one. I shouldn't even need to install SQL server to do queries on a remote server anyway, right?
I've turned off my Windows firewall and my router firewall, though ShieldsUP still says
Port: 3306
Status: Stealth
Your system has achieved a perfect "TruStealth" rating. Not a single packet — solicited or otherwise — was received from your system as a result of our security probing tests. Your system ignored and refused to reply to repeated Pings (ICMP Echo Requests). From the standpoint of the passing probes of any hacker, this machine does not exist on the Internet. Some questionable personal security systems expose their users by attempting to "counter-probe the prober", thus revealing themselves. But your system wisely remained silent in every way. Very nice.
I read that this is irrelevant as well, since I'm not the one hosting the server, but when I was given the address, I was given the port as well, so I must have to do something with it. I'm just not sure what. My understanding of ports really is quite shaky.
I've been trying this for over a day now, and I can't think of anything more I can do.
EDIT: I fixed the problem. I had to use MySQL, not MSSQL. Doh. Sorry guys.
If you are sure the remote SQL Server is running on port 3306 (otherwise I'm not sure why you talked in the question about that port specifically), try the following connection string:
user id=username; password=password;
data source=123.45.678.90,3306;
initial catalog=dbname;
Network Library=dbmssocn;
I think without the port you'll have trouble if the other end has disabled the SQL Browser service. You should also make sure it isn't a named instance, in which case you may need:
user id=username; password=password;
data source=123.45.678.90\InstaneName,3306;
initial catalog=dbname;
Network Library=dbmssocn;
First of all the database is local or distant ?
The you have to ensure that your connection string is well written.
Here's an example of a valid connection string :
Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
More about connection strings :
Connection Strings
Now if everything is set up correctly you have to enable remote connections to SQL Server on the host. To do so please refer to this article :
Enable SQL Server Remote Connections
Just go to ypur serveices and check whether your SQL Server (MSSQLSERVER) is running.Most of the time this error happens when SQL Server (MSSQLSERVER) is stopped.
Then select it right click and click start.problem solved !!!
In my development shop, we deploy code on virtual servers that sit on a remote network.
We access the machines on that network by first opening an SSH connection to a gateway server, and then SSH-tunneling RDP over a local port.
I would very much like to be able to locally access SQL Server instances running on these servers in the same way.
I've set up a local port (3398) to redirect to the SQL Server port on the remote instance (L3398 -> remote.machine.com:1433).
I can then actually test the connection by telnetting to localhost 3398, and I get a connection: the screen clears and I can type characters to some listening process.
But when I try to connect SSMS to localhost:3398, it times out and then claims that there is no SQL Server listening on that port:
Cannot connect to localhost:3398
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. (...)
I am sure that the server accepts remote connections, because I have connected to it remotely while logged in via RDP to a different machine within the remote network.
I have Googled around to know that this is possible; does anyone have some idea why this isn't working, or what I might do to diagnose and hopefully fix the problem?
Thanks!
Instead of connecting to localhost:3398
Use 127.0.0.1,3398
For Authentication type Azure Active Directory - Universal with MFA (Mutli-Factor Authentication), in addition to specifying the port correctly (127.0.0.1,3398), I also had to point the host to localhost.
On Windows, I had to edit my hosts file to include the server host:
127.0.0.1 server.example.com
Then, in SSMS, I could connect to server.example.com,3398, which would perform the MFA correctly.
I could have performed this redirection at a higher DNS level as well.
The issue is probably that SSMS is trying to access the SQL Server Browser Service, which is UDP port 1434. Take a look at http://technet.microsoft.com/en-us/library/cc646023.aspx for an overview of the additional ports you may need to forward to get this to work.
I'm pretty sure I figured out the answer to this, actually.
On the remote network (which we don't control), for security purposes, it appears that the database servers are set up to ignore database requests coming from the gateway machine. So I guess there's just no good solution short of convincing them to give us full VPN access. Thanks everyone for your help.