Article ID: 180223 - Last Review: January 6, 2006 - Revision: 3.1 How to synchronize writing and reading performance between two DAO processesThis article was previously published under Q180223 On This PageSUMMARY The Microsoft Jet database engine (the underlying engine
used by DAO to write and read to a Microsoft Access database file) uses a page
buffer to improve write and read performance. Because of this buffering
activity, you cannot accurately predict the time it will take for a write from
one process to be subsequently read by another process. Every process that uses the Jet database engine maintains a private page buffer, which makes synchronous write/read activity between two processes difficult to achieve. For example, suppose you have two processes (Process 1 and Process 2) using the Jet database engine to write and read data to and from the same database file. When Process 1 writes to the database, the new data may not immediately get flushed to the physical database file. When Process 2 reads from the database, it may be reading a data page in the page buffer, rather that the new information written by Process 1. So if Process 1 writes a record to the database and then signals Process 2 to read the same record, the read may occasionally fail due to the independent buffers. This article demonstrates how to optimize a DAO-based program so that writes to a physical database and reads from a physical database are likely to occur in a synchronous manner. Use the techniques described here to help you obtain the best possible synchronous writing and reading performance when using DAO. Important notes
MORE INFORMATIONForcing a write using DAOWith the release of the Microsoft Jet 3.5 database engine, you can force a write to the physical database file by using the dbForceOSFlush flag in conjunction with a DAO workspace transaction. This functionality is available to both the DAO 3.5 SDK and to the MFC DAO classes that ship with Visual C++. Calling the CommitTrans(dbForceOSFlush) method tells the Microsoft Jet database engine to write the contents of the page buffer out to the physical database file. All new information in the page buffer is written out to the physical database file before the call to CommitTrans returns.Using DAO 3.5 SDK codeUsing MFC DAO codeForcing a read using DAOWith the release of the Microsoft Jet 3.5 database engine, you can force a synchronous read from the physical database file by using the dbRefreshCache flag in conjunction with the workspace Idle method. This functionality is available to both the DAO 3.5 SDK and to the MFC DAO classes that ship with Visual C++.Calling the Idle(dbRefreshCache) method tells the Microsoft Jet database engine to completely refresh the page buffer with the current information from the physical database file. All updated pages in the physical database is pulled into the page buffer before the call to Idle returns. Using DAO 3.5 SDK codeUsing MFC DAO codeAPPLIES TO
| Article Translations
|
Back to the top
