Article ID: 178942
Article Last Modified on 11/21/2006
DAODBEngine* AFXAPI AfxDaoGetEngine()
{
// Return DAODBEngine object for direct access
return AfxGetDaoState()->m_pDAODBEngine;
} The following line of code returns a pointer to the DB engine. No
special header files are required:DAODBEngine* m_pDAODBEngine = AfxDaoGetEngine();Once you have a pointer to the DB engine, the DAO SDK function SetOption() can be used to set performance parameters. These parameters only affect the specific instance of the engine for your application. They do not affect the default Jet performance parameters stored in the registry. The following code examples show how to change some of the specific parameters:
// Change the MaxBufferSize to 128. When doing thousands of // inserts, this will restrict memory growth. COleVariant vBufferSize((long)128, VT_I4); m_pDAODBEngine->SetOption( dbMaxBufferSize, vBufferSize );
// Reduce the time to defer asynchronous flushes on a // database opened for exclusive use. COleVariant vExclusiveAsyncDelay((long)10, VT_I4); m_pDAODBEngine->SetOption(dbExclusiveAsyncDelay,vExclusiveAsyncDelay);
// Reduce the time to defer asynchronous flushes on a // database opened for shared use. COleVariant vSharedAsyncDelay((long)15, VT_I4); m_pDAODBEngine->SetOption(dbSharedAsyncDelay, vSharedAsyncDelay);Note It is necessary to cast the first parameter in the constructor for the COleVariant in order to avoid the "ambiguous call to overloaded function" error at compile time.
| PageTimeout | 5000 |
| SharedAsyncDelay | 100 |
| ExclusiveAsyncDelay | 2000 |
| LockRetry | 20 |
| UserCommitSync | Yes |
| ImplicitCommitSync | NO |
| MaxBufferSize | 0 |
| MaxLocksPerFile | 9500 |
| LockDelay | 100 |
| RecycleLVs | 0 |
| FlushTransactionTimeout | 500 |
Initializing the Microsoft Jet 3.5 Database Engine Driver
Additional query words: defaults settings registry
Keywords: kbinfo kbhowto kbjet KB178942