views:

2301

answers:

2

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:

  1. The application runs a query
  2. A new connection to SQL Server is opened (visible in SQL Server Profiler)
  3. 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.
  4. The query runs on SQL Server
  5. 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.

A: 

Check Microsoft SQL Server Native Client at http://www.microsoft.com/downloads/details.aspx?FamilyID=d09c1d60-a13c-4479-9b91-9e8b9d835cdc&displaylang=en

I've tried installing the newest SQL Server Native Client (https://www.microsoft.com/downloads/details.aspx?displaylang=enServer=[server name];Connect_Timeout=300;Trusted_Connection=Yes;APP=Microsoft Office 2003;DATABASE=[db name]</code>Same result, still slow.
AronVanAmmers
+2  A: 

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.

Paul Keister
We (or rather, our customer) are running a domain controller, yes.Although your suggestion sounds promising, it didn't help. Named pipes turned out to be already disabled on the server. So we can be sure TCP/IP is used as the network protocol between the client and the SQL server.
AronVanAmmers
Sorry to hear this didn't help. Have you tried enabling named pipes on the server? It might be that the client is trying a named pipes connection and failing over to TCP/IP, with the failover causing the performance hit. Of course this won't work if the server is behind a fierwall with MS networking ports blocked.
Paul Keister
Will try enabling named pipes and will report back. Would that also explain why why SQL Server authentication is fast as opposed to Windows Authentication, and why the SQL Server machine does a Logon/Logoff event on almost every query from Access?
AronVanAmmers
This might work, but since I'm 0 for 1 on this issue I will refrain from any guarantees. I am not a network expert, but I do know from experience that Windows authentication likes to operate over named pipes. My orignal advice was based on the idea that the problem could be solved by moving out of the default named pipes protocol, but we might fix the problem by embracing named pipes. My suggestion to disable NP at the server was a reach, but I've actually gotten results from that. cn string fix has a better chance, the core principal is to get client and server protocol config matched.
Paul Keister