Implement Persistent Connections with Linked Tables

Microsoft Jet uses the locking information (.ldb) file to track which users have the database open and to track the locking of pages in the .mdb file. In Microsoft Jet 3.0 and 3.5, the .ldb file is deleted when the last user closes the database. This is done to prevent accumulation of .ldb files when replication is being used. However, in situations where only one user is accessing a linked table, particularly in a looping routine, this causes a significant degradation in performance. The reason for this is that linked tables do not keep persistent connections to the database where their data resides. This causes additional disk I/O to delete, re-create, and establish locks on the locking information file.

To prevent this, design your application so that it maintains a persistent connection to any linked Microsoft Jet tables. To do this, declare public recordset variables for each linked table your application uses, use the OpenRecordset method to open those tables at the beginning of your application, and only close these recordset variables when your application itself closes. Maintaining persistent connections to linked tables can improve performance significantly because it prevents Microsoft Jet from constantly deleting, creating, and obtaining locking information from the other database’s locking information file.