I've changed the Connection Timeout to 10 seconds.
'...;Connection Timeout=10;..."
The code uses EF 6, .Net 4.5.1.
SQL Server Client has both tcp/ip and Named Pipes enabled.
Disconnected from the Network and then start debugging.
The timeout error happens at the 1 minute mark.
This seems to indicate the error happens when the sql server is not located.
Is SQL Server Ado.net client code is setting the network timeout?
I had thought this was fixed a while ago, like back in 2.0 days.
Related
We have a MS-Access front application using data from a SQL server back-end. We are using ODBC connections for the data communications. The application randomly getting frozen or crashes giving different errors as attached below which very likely seems to be issues related to ODBC connection. Problems can be recreated by running different queries in quick successions.
SQL Server Version: SQL Express 14.0.3356.20
Access Version: Microsoft 365 Apps for Business Version 2011 (Build 13426.20204)
Most common error codes:
10054, 10060, 3146, 3151
ODBC Data Source Type: System DSN
ODBC Driver: ODBC Driver 17 for SQL Server (Version 2017.176.01.01)
Example Connection String for a linked table: ODBC;Description=Test Description;DRIVER=ODBC Driver 17 for SQL Server;SERVER=MY-SERVER;UID=MyUser;Trusted_Connection=No;APP=Microsoft Office;DATABASE=TestDatabase;;TABLE=dbo.TableName
Largest Table Size: 53000 records (Doesn't really matter, fails for even smaller queries, but if you try faster getting results from different queries you can break it)
Error1 Error2 Error3
We have gone through hundres of searches/articles about these and applied the fixes listed below, but still couldn't get the problem solved.
We have tried below solutions as of now which didn't help.
Created firewall rules (Inbound - TCP Port 1433, Outbound - TCP all
ports)
Added TCP Port 1433 - TCP/IP protocol
Enabled Namepipe
Updated SQL Server Express from 14.0.3335.7 to 14.0.3356.20
Made IP4 and IP6 are both enabled
Enabled and checked ODBC Trace Logs
Checked Windows Event Logs
Hope I have included everything that might be useful to get some help resolving this issue.
Note: Not sure if it's related, but the SQL Server itself (in the backend) giving the below error in rare occasions if it helps.
Connection Timeout Expired. The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement. This could be because the pre-login handshake failed or the server was unable to respond back in time. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=29278; handshake=26244; (.Net SqlClient Data Provider)
Thanks everyone who tried to help. This issue has now been fixed.
For anyone who will come here in future looking for a solution for a similar issue, below is what worked for us.
Added a new instance of SQL Server 2019 (in the same virtual machine
which 2017 sits on)
Enabled UDP Port 1434
Changed virtual port from blank to zero
2017 was still crashing before taking offline with the same settings.
No issues with the 2019 version.
I have a .vbs script which is carrying out some modelling. This script is fired via a windows scheduled task and performs a fair amount of database selects, inserts and updates.
It has run many times over the years on SQL Server 2008 R2. Its now trying to run on win2016 Server running SQL Server 17.4. The job will run for a couple of hours ideally. Its stopping a little over an hour after almost 10,000 successful inserts, it throws me this error:
Database Error: -2147467259 Microsoft SQL Server Native Client 11.0 : Named Pipes Provider: Could not open a connection to SQL Server [5].
Is this SQL Server taking its resources back for some reason? Any ideas on resolving this would be very helpful?
Update : I have reduced the workload of the script. Instead of running for a couple of hours it now runs for less than one hour. The first two runs have been successful, no issues.
i supose that you try to conect to another server or to the local server across with one computer with network , so check if you have this correct configuration :
enter link description here
I'm running SQL Server 2014 Express and using the SQL Server native drivers for the connection from my VS.net code. These are both on my Win10 machine.
Suddenly, in the last week or so, I've been receiving errors when my code attempts to connect. Of course the dialog doesn't allow cut-n-paste, so helpfully this is correct:
Named Pipes Provider error 40 - Could not open connection to SQL Server
This only happens about 1 in 10 times that I run the app. If I simply stop it and re-run it, it instantly connects. Another machine in the office running Win7 and SQL Server 2012 started showing the same behaviour, but fails all of the time now.
Note: yes, the server is running, the firewall is configured properly, as is the server's connections, the browser is up, etc. It's important to note that these would cause it to fail 100% of the time.
Does anyone have any ideas what's going on? Was there a recent driver update that might cause this perhaps?
I usually create queries using Visual Foxpro 9.0 from a desktop computer to a MS SQL Server 2005 running on Windows Enterprise Server (2003). My queries are repetitive and sometimes, one session would query the SQL server 200,000 times in rapid succession. For the first few days, my program is running fairy well but then suddenly the SQL Server is refusing to process the queries.
On checking the logs in the SQL Server, I found out that a certain spid is killing my query process:
Process Id 71 was killed by Hostname SQLSERVER, Host Process ID xxxx.
I am confused because the hostname is not the SQL Server I am querying but another SQL Server.
From the activity monitor I noticed that the offending Process ID has the following information:
62 NO sa master sleeping 0 AWAITING COMMAND Sql Agent - Generic Refresher ..
The details shows a message:
SET NO_BROWSETABLE ON
Lastly, thinking that it may be a problem with visual FoxPro, I tried running queries from the desktop machine from within SQL Server Management studio, I still encountered the same problem when I tried queries to the SQL Server:
A transport-level error has occurred when sending the request to the
server. (provider: TCP Provider, error: 0 - An existing connection was
forcibly closed by the remote host.)
It's mind boggling because I am able to establish connections but my queries are refused by the server. Again, thinking that my desktop is the problem, I tried running the queries from another computer. It was running at first then suddenly the same problems occurred. Now these two desktops are refused by the server.
I am thinking that this might be a security but I don't know how to resolve this problem.
We also tried to restore our database backups to another host, the same scenario happened... Fine at first then the problem appeared after a few query sessions.
The following are the ODBC SQL Server Drivers:
Microsoft Ole DB Provider for Sql Server
Sql Server Native Client 10.0
Sql Server Native Client 11.0
I have search the web for a possible solution and I tried the suggested solutions, spid blocking, chimney offloading, rss, among others but to no avail. Please, In need your expert advise!
Thank you in advance.
i have my server written with structure map and fluent nhibernate,
when i run my server from my pc and direct him to the db on another server i get a sqlexception that tells me that the timeout expired
this is the message :
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
the line in code that marked on debug is
_transaction = _session.BeginTransaction();
any suggetions?
the db is mssql 2008
First thing to do is make sure you have connectivity to that other database. Open management studio and try to connect.
If that connects, then you need to make sure you have all of your settings setup correctly. Check the web.config and the hibernate.xml file.