HOWTO: Use a Custom Jet Profile to Alter Data Access BehaviorLast reviewed: September 11, 1997Article ID: Q173646 |
The information in this article applies to:
SUMMARYYou can edit the Jet Registry keys to alter the data access behavior of the Microsoft Jet database engine. However, doing so affects all Jet-based applications, and may have unintended negative consequences for some. By using custom profiles, you can tune Jet on a per-application basis.
MORE INFORMATIONIn 16-bit versions of Visual Basic and Microsoft Access, Jet settings are stored in an .ini file (for example, Msaccess.ini or Msacc20.ini). You can provide a custom .ini file with your application that contains settings specific to your application. The 32-bit versions of Jet read their settings from the registry. In Visual Basic 4.0 and 5.0, Jet versions 3.0 and 3.5 use the default registry location:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\3.0 -or- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\3.5If using Microsoft Access, settings are read from the following branch first, and then the default location (above) is used for any additional values:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Access\7.0\Jet\3.0 -or- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\8.0\Access\Jet\3.5To prevent multiple applications from making custom changes to these settings and negatively impacting other Jet-based programs, the application can tell Jet to read its settings from a different branch of the registry. These alternate branches are known as Profiles. You don't have to reproduce the entire registry branch in your profile. Values you specify in your custom profile override values specified in the default registry location, which in turn override internal Jet default values.
Example ProfileNOTE: Inadvertent changes to the Registry could affect the stability of the operating system. You should back up the registry prior to proceeding. This example illustrates registry changes for a custom profile that lowers the LockRetry setting from the default value of 20 to 5.
Using the Profile in Visual BasicTo use the profile in Visual Basic, set DBEngine.IniPath to the profile name prior to using any database functionality: In Visual Basic 4.0:
DBEngine.IniPath = _ "HKEY_LOCAL_MACHINE\SOFTWARE\MyCorp\MyApp\1.0\Jet\3.0"In Visual Basic 5.0:
DBEngine.IniPath = _ "HKEY_LOCAL_MACHINE\SOFTWARE\MyCorp\MyApp\1.0\Jet\3.5" Using the Profile in Microsoft AccessUnlike visual Basic, where you can set the profile name programmatically, Jet is already initialized by the time your Microsoft Access code is running. To specify a profile name, you need to add another registry key to specify a "friendly" profile name and use a command-line switch when starting Microsoft Access:
Compatibility with Earlier Jet DatabasesIf the database you're opening is used by earlier versions of Jet (1.0, 1.1, 2.0, or 2.5), Microsoft Jet 3.x doesn't read these files directly. It uses an Installable ISAM engine in the same way it would when reading a dBase or Paradox file. For example, to set the LockRetry value for accessing a Jet 2.x database, add the Value to the following location:
HKEY_LOCAL_MACHINE\SOFTWARE\MyCorp\MyApp\1.0\Jet\3.0\Engines\Jet 2.x\ISAMYou still only reference the profile location as indicated in the Microsoft Access and Visual Basic usage sections above. For example: In Visual Basic:
DBEngine.IniPath = _ "HKEY_LOCAL_MACHINE\SOFTWARE\MyCorp\MyApp\1.0\Jet\3.0" -or- DBEngine.IniPath = _ "HKEY_LOCAL_MACHINE\SOFTWARE\MyCorp\MyApp\1.0\Jet\3.5"In Microsoft Access:
Value: HKEY_LOCAL_MACHINE\SOFTWARE\MyCorp\MyApp\1.0 Table of Engine KeysThe following table lists registry branches for the Jet 3.x engine and the various other engines:
Engine Registry Branch ---------------------------------------------------- Jet 3.x ...\Engines\Jet Jet 2.x ...\Engines\Jet 2.x\ISAM ODBC ...\Engines\ODBC Xbase ...\Engines\Xbase Paradox ...\Engines\Paradox Excel ...\Engines\Excel Lotus ...\Engines\Lotus Text ...\Engines\Text Jet 3.5 NotesWith Jet 3.5, you can tune some values dynamically using the new SetOption method of the DBEngine object. This means you can use some values for one part of your program, that is, to favor a bulk update, while using other values in another part of your program, that is, to favor interactive data entry. Using DBEngine.SetOption affects only the current instance of your program. It can be used in Microsoft Access 97 and Visual Basic 5.0. The following table lists the settings you can change:
Setting Constant --------------------------------------------------- PageTimeout dbPageTimeout SharedAsyncDelay dbSharedAsyncDelay ExclusiveAsyncDelay dbExclusiveAsyncDelay LockRetry dbLockRetry UserCommitSync dbUserCommitSync ImplicitCommitSync dbImplicitCommitSync MaxBufferSize dbMaxBufferSize MaxLocksPerFile dbMaxLocksPerFile LockDelay dbLockDelay RecycleLVs dbRecycleLVs FlushTransactionTimeout dbFlushTransactionTimeoutUsage:
DBEngine.SetOption dbMaxBufferSize, 128 REFERENCESFor a complete list of Jet engine registry settings and their descriptions, refer to
Appendix C of the Microsoft Jet Database Engine Programmer's Guideor the Help topic:
Customizing Windows Registry Settings for Data Access ObjectsFor help with Microsoft Access Profiles, see the Help topic "Profiles, User." To programmatically read/write registry settings, please refer to the following Knowledge Base article:
ID: Q145679 Title: How to Use the Registry API to Save and Retrieve Setting Customizing Windows Registry Settings for Data Access Objects
|
Additional query words: vb5 vb4
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |