Client Applications losing Db Connectivity - sql-server

I am a Support technician for an Application using a 2008 SQL Server Express database and the our client app-installations occasionally loses connection to the SQL Server database.
Note: I am a total beginner with SQL and unfortunately our company no longer has an application Eng.
So where to begin? Our customers usually have a few client applications installed (say 2 to 10) and for the most part the application will connect to the server's DB without error. Then all of a sudden we fail to connect, usually with a simple "Unable to connect to the database" error.
Interestingly, in most cases they can wait 30+mins and the problem goes away.
We have the Named Pipes and TCP/IP enabled for remote connections. Any suggestions to consider?

Related

Cannot connect Access to SQL Server Linked Tables - error message loggingin

I have a client for which I am setting up a new SQL Server Express and (on a different computer) connecting their Access front end to that SQL Server. I created an account on SQL Server, changed authentication to SQL Server. I am able to log on to that account with no issues locally (through SQL Server Management Studio) on the server itself, but when I go back to the client machine and try to create either an ODBC connection or connect directly in Linked Table manager, I get the error below. Looking at the error log in SQL Server I can see no failed logins. In Access and/or ODBC I use Servername\SQLEXPRESS, choose SQL authentication and type in the username/password that I created. But it's still being stubborn.
I'm kind of at my wits end with this one. I checked to make sure that login is enabled, that the created database is mapped to this user, but I'm out of answers. Anyone have any ideas? I'm sure it's something really stupid that I'm overlooking, I've used SQL Server for a long time but I'm not an experienced DB Administrator I'm sure it's something really simple I'm overlooking, but I've done this hundreds of times before. And Windows Authentication won't work because it's on a different computer.
To connect to a named instance on SQL Server Express with Servername\SQLEXPRESS, you need:
SQL Server Browser service running,
and its UDP port 1434 open in the firewall.
https://learn.microsoft.com/en-us/sql/sql-server/install/configure-the-windows-firewall-to-allow-sql-server-access
SQL Server Browser service
UDP port 1434
The SQL Server Browser service listens for incoming connections to a named instance and provides the client the TCP port number that corresponds to that named instance.
The fixed TCP port for your instance open in the firewall.
You set this in SQL Server Configuration Manager
https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/configure-a-server-to-listen-on-a-specific-tcp-port
This looks more like a network setting rather than server issue.
Check if all necessary permissions, configuration and settings on your machine running the server are OK to accept external connections.
Usually its the server that is rejecting the connection for security reasons.

How to Fastes Remote Connection in SQL Server

I am making a website for PvP servers in PHP language. I have to comply with my own server so that my software does not have w-a-r-e-z. But I have to connect to the client's database with sql remote. (SQL Server 2014).
While the script is running very fast on the local connection, the remote sql connection opens 1-2 minutes late. This, in turn, will not please the customer. I can not imagine if they think you get 500-1000 hits. What can I do in this situation?

SQL Server 2012 - Distant connection issues with Integrated Security

I have two SQL Servers : one in Dijon, France; one in Arvada, Colorado, US. A data replication has been set up between them.
Everything works fine when users try to connect to SQL Server 2008 R2 Dijon database.
BUT an error occurs when one of my users is trying to connect to SQL Server 2012 US database from a VB.Net application.
The error is :
"A connection was successfully established with the server, but then an error occurred during the login process (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)"
This error shows up only for one user. The others can connect without any issue. I have maybe a clue about this. We already encountered connection issues for him, because he belonged to many AD security groups.
Here is the connection string :
Data Source=server\instance;Initial Catalog=db;Integrated Security=SSPI;Connection Timeout=0;
We have the same issue for a US user trying to connect to the same server. But not when he tries to connect to Dijon. Do you have any clue that could help me resolving this issue please ?
I checked StackOverflow threads and other solutions from the web, but nothing helped me...
Refer following URLs
Troubleshooting: Connection Forcibly Closed
TCP Provider, error:
connection was forcibly closed
Follow these steps
First goto services and check whether 'SQL Server Browser' service is started, if not start the service.
Open SQL Server Configuration Manager
Goto Protocols for MSSQLSERVER
Enable all protocols
Goto SQL Native Client
Select Client Protocols and and Enable All
Restart the SQL Server services.
Use .. (.NET Framework Data Provider for SQL Server) as provider
Connectionstring
Data Source=server\instance;Initial Catalog=;Persist Security Info=True;User ID=;Password=;Network Library=dbmssocn
It was, as I expected, a problem of Kerberos authentication because my user has too many AD security groups...
The solution is explained here : Problems with Kerberos authentication when a user belongs to many groups and here MaxTokenSize and Windows 8 and Windows Server 2012
If the authorization data for a user attempting to authenticate is larger than the MaxTokenSize, then the authentication fails for that connection using that protocol.
On Windows 7 and Windows Server 2008R2 , the MaxTokenSize (the default buffer size for Kerberos) is 12k. Its size has been increased in Windows 8 and Windows Server 2012 to 48k. It wasn't enough for my case.
I had to add a key in the registry HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\Kerberos\Parameters\MaxTokenSize (REG_DWORD type to the decimal value 65535).
Then I rebooted the server.
My user can now access data without error.

Why are the ODBC queries from my desktop is blocked by the sql server after running several queries in rapid succession?

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.

MS Access 2003 + linked tables to SQL Server 2005 + Windows Authentication = slow

Our MS Access application with linked tables to SQL Server 2005 is slow when using Windows Authentication from Windows XP clients.
We've been running it successfully using SQL Server authentication, but now we want to move to Windows Authentication for better security control.
Setup:
Database server: Windows 2003 Server, SQL Server 2005 SP2
Client: Windows XP SP3, SQL Server ODBC driver v2000.85.1132.00
MS Access application: MS Access 2003
Connection string:
DRIVER=SQL Server;SERVER=[server name];Connect Timeout=300;Trusted Connection=True;APP=Microsoft Office 2003;WSID=[server name];DATABASE=[db name]
Only the TCP/IP network protocol is enabled on the server.
The slowness does not happen in these situations:
App on DB server, SQL Server Authentication
App on DB server, Windows Authentication
App on Windows XP client, SQL Server Authentication
SQL Server Management Studio on client, Windows Authentication - I did a small test with running 15 queries in SQL MS. This went fast and did not cause any logon/logoff events in the Security event log on the server.
I've analyzed the slowness using SQL Server Profiler and the event log on the server and it seems to come down to this:
The application runs a query
A new connection to SQL Server is opened (visible in SQL Server Profiler)
The identity of the user is verified (visible in the Security event log on the server, a logon/logoff event happens). This takes several hundreds of milliseconds.
The query runs on SQL Server
Results are returned to Access
This happens for every query. Some of the forms run +- 10 queries when showing a new record (updating sub forms, loading values for combo's etc). This results in very slow performance.
Of course setting up a new connection to SQL Server for every query isn't necessary, and reusing connections might solve the issue. I've been looking around for information on how to make sure Access/ODBC does proper connection pooling. I found these MS KB articles:
Frequently Asked Questions About ODBC Connection Pooling
How to Enable Connection Pooling in an ODBC Application
I've tried calling the SQLSetEnvAttr function from the main form of the Access application, but this didn't improve results.
Any help is greatly appreciated.
The first question I have is: are you running a domain controller? This may sound like a crazy question, but I just want to make sure. Although is less and less common, I've seen organizations run Windows networks with workgroups and "pass-through" authentication. The symptoms you describe are the same as would be observed on a network that is set up in this fashion.
Assuming you do have a proper domain set up, you must have a problem somewhere in the Named Pipes network stack. Named Pipes is the default protocol if you're using Windows authentication. It's not a bad idea to get to the bottom of this if you have the time, but if you just want to fix your performance problem, then I would force the TCP/IP protocol in your connection string:
DRIVER=SQL Server;SERVER=tcp:[server name];Connect Timeout=300;Trusted Connection=True;APP=Microsoft Office 2003;WSID=[server name];DATABASE=[db name]
Note the addition of the tcp: prefix. I got this syntax from Jon Galloway's blog. TCP/IP is the default protocol for SQL Server Authentication. You can also make the protocol switch by disabling Named Pipes support on the server, but this is more of a hassle and could cause other unanticipated problems.
Check Microsoft SQL Server Native Client
at http://www.microsoft.com/downloads/details.aspx?FamilyID=d09c1d60-a13c-4479-9b91-9e8b9d835cdc&displaylang=en

Resources