AronVanAmmers
AronVanAmmers

Reputation: 1666

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:

The slowness does not happen in these situations:

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.

Upvotes: 4

Views: 6370

Answers (2)

Paul Keister
Paul Keister

Reputation: 13077

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.

Upvotes: 3

Related Questions