ACC1x: How Microsoft Access 1.x Uses SQL Server Connections

ID: Q88655


The information in this article applies to:


SUMMARY

This article describes how Microsoft Access uses connections to SQL Server and how application developers can minimize the use of these connections.

This article assumes the you are highly knowledgeable about the low- level interaction between applications and SQL Server.


MORE INFORMATION

The conventional application that accesses a server does it in a simple single-tasking manner, requiring a single connection to the server. Microsoft Access, however, is not a typical conventional server front-end. Many of its features, including updatable views (dynasets), joins between local and server data, execution of complex expressions that the server may not be able to handle, and seamless transition from one server to another, require Microsoft Access to obtain more connections than a conventional front-end.

Although some servers, such as Microsoft SQL Server, are not stingy giving out connections, there are other servers that place strict limits on the number of connections an application can open. (In some installations, SQL Server also places absolute restrictions on connections.) When designing applications for the more restrictive servers, it is important to understand how Microsoft Access uses connections.

Connections are opened by Microsoft Access when it needs to execute a query on the server (which it must do to build dynasets or static views), obtain the data in a dynaset, or update data on the server. These connections can be categorized into two types: connections needed to build the working set and connections needed to service dynasets.

Both types of views available in Microsoft Access (static views and dynasets) are built by executing a query (called a "local" query to differentiate it from other types of queries discussed in this article). This local query processes Microsoft Access and foreign ISAM data (both locally and file server based) and remote server data, and pulls it into a temporary table that represents the view. To build static views, the actual data is stored in the temporary table, whereas to build dynasets, pointers to the actual data are stored.

When server data is included in the local query, execution of the query involves asking the server (or servers) for data, which is done by opening connections and sending queries to the server. Each query sent to the server requires that a connection be opened. If more than one query is to be sent to the server, a single connection could be used and the queries executed serially. However, this would typically require the user to wait for all of the server queries to complete before any data would appear. Therefore, Microsoft Access executes the server queries in parallel, requiring a connection for each.

The number of queries sent to a server may not be entirely obvious. Much of the time, access to all of the remote base tables will be combined into a single query, if all of the base tables reside on the same server. In the worst case, each server base table referenced by the local query will require a connection. There are several factors that could compel Microsoft Access to split a local query into several server queries:

As a result of the above rules, when Microsoft Access executes a query, it typically requires only one (for a static view) or two (for a dynaset) connection. This does not represent an extravagant use of server connections, but good applications could involve the execution of many Microsoft Access queries that could occupy many server connections very quickly. There are some steps the designer can take to minimize the use of connections:
With an understanding of how Microsoft Access uses connections, and with prudent application design, you should not run out of server connections.


Keywords          : kbusage OdbcOthr 
Version           : 1.0 1.1
Platform          : WINDOWS 
Issue type        : kbhowto 

Last Reviewed: March 10, 1999