Jump: Search:

Total Visual SourceBook

Total Visual SourceBook CD and Printed Manual

Microsoft Access 2007/2010 Version
is Shipping!

New features in Total Visual SourceBook for Access, Office 2007 and VB6

Supports Access/Office 2010 (32 bit), 2007, 2003, 2002, 2000, and
Visual Basic 6.0!

Also available for:
Access 97/95


View all FMS products for Microsoft AccessAll Our Microsoft Access Products

SourceBook Info:

Why SourceBook?

 

"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."

Van T. Dinh, Microsoft MVP

 

 

 

 

 
Royalty free source code library modules for Microsoft Access, VB6, VBA, OfficeRoyalty free source code library modules for Microsoft Access, VB6, VBA, OfficeVBA and VB6 Source Code Library Download the free trial version of Total Visual SourceBook for Microsoft Access, Office, VB6 and VBA
Category: Database : Access/Jet
Description: Microsoft Access Jet databases and their objects (MDB and ACCDB database formats)

Class: CJetEngine

Manage Access database characteristics such as passwords, encryption, compact, workspaces and tuning through DAO

The Microsoft Jet Database engine is exposed through the Data Access Objects (DAO) interface as the DBEngine object. Through this object, you can set various engine-wide parameters, and work with Jet workspace and database objects. This class puts a layer of high-level functionality on the Jet engine. You can use the properties and methods in the class to perform engine-level operations, such as database maintenance, setting performance tuning options, retrieving low-level statistics, and setting workgroup options for secured databases.

Procedure Name

Type

Description

(Declarations) Declarations Declarations and private variables for the CJetEngine class
Database Property Gets a handle to the current open database. This property exposes the database object in use by the class. This object only has meaning after it has either been Set to an existing database object, or a call has been made to the class OpenDBInWorkspace method.
ISAMCacheReads Property Gets the number of Jet engine cache reads since the last reset. Use the ResetISAMCacheReads method to reset this value to 0 This value returns the number of times the Jet engine has read data from its internal cache. This number does not include the number of reads from the read-ahead cache (see the ISAMRACacheReads property for information on the read-ahead cache). Use the ResetISAMCacheReads method to reset this value to 0
ISAMDiskReads Property Gets the number of Jet engine disk reads since the last reset. Use the ResetISAMCacheReads method to reset this value to 0 This value returns the number of times the Jet engine has read data from its internal cache. This number does not include the number of reads from the read-ahead cache (see the ISAMRACacheReads property for information on the read-ahead cache).
ISAMDiskWrites Property Gets the number of Jet engine disk writes since the last reset. Use the ResetISAMDiskWrites method to reset this value to 0. This value returns the number of times the Jet engine has written data to a local or network disk. This figure includes all writes, including background read-ahead cache reads that happen in separate threads. One write doesn't necessarily equal one page, as is often the case when using transactions.
ISAMLocksPlaced Property Gets the number of Jet engine locks placed since the last reset. Use the ResetISAMLocksPlaced method to reset this value to 0.
ISAMLocksReleased Property Gets the number of Jet engine locks placed since the last reset. Use the ResetISAMLocksReleased method to reset this value to 0. Note that the number of locks placed and locks released may not match. This is because a single call to release a lock may result in the release of more than one lock.
ISAMRACacheReads Property Returns the number of Jet engine read-ahead cache reads since the last reset. Use the ResetISAMRACacheReads method to reset this value to 0. This value returns the number of times the read-ahead cache has been read. In some cases, the Jet engine reads more pages of data than are requested--this additional data is stored in the read-ahead cache so that it is readily available when needed.
TuneExclusiveAsyncDelay Property Sets the Jet engine's ExclusiveAsyncDelay tuning value, which controls the length of time to defer an asynchronous flush of an exclusive database. The default when Jet is started is 2000 milliseconds.
TuneFlushTransactionTimeout Property Sets the Jet engine's FlushTransactionTimeout tuning value. This entry disables both the ExclusiveAsyncDelay and SharedAsyncDelay settings. To enable those settings, a value of zero must be entered. FlushTransactionTimeout changes the Jet's method for doing asynchronous writes to a database file.
TuneImplicitCommitSync Property Sets the Jet engine's ImplicitCommitSync tuning value which controls whether the system waits for a commit to finish. A value of False instructs the system to proceed without waiting for the commit to finish; a value of True instructs the system to wait for the commit to finish. The default when Jet is started is False.
TuneLockDelay Property Sets the Jet engine's LockDelay tuning value. This setting works in conjunction with the LockRetry setting in that it causes each LockRetry to wait 100 milliseconds before issuing another lock request.
TuneLockRetry Property Sets the Jet engine's LockRetry tuning value which controls the number of times to repeat attempts to access a locked page before returning a lock conflict message. The default when Jet is started is 20.
TuneMaxLocksPerFile Property Sets the Jet engine's MaxLocksPerFile tuning value which prevents transactions in Jet from exceeding the specified value. If the locks in a transaction attempts to exceed this value, then the transaction is split into two or more parts and partially committed.
TunePageTimeout Property Sets the Jet engine's PageTimeout tuning value which controls the length of time between the time when data that is not read-locked is placed in an internal cache and when it's invalidated, expressed in milliseconds. The default when Jet is started is 5000 milliseconds.
TuneRecycleLVs Property Sets the Jet engine's RecycleLongValues tuning value. This setting, when enabled, causes Jet to recycle long value (LV) pages (Memo, Long Binary [OLE object], and Binary data types). Jet 3.0 would not recycle those types of pages until the last user closed the database. If theRecyleLVs setting is enabled, Jet 3.5 will start to recycle most LV pages when the database is expanded (that is, when groups of pages are added).
TuneSharedAsyncDelay Property Sets the Jet engine's SharedAsyncDelay tuning value which controls the length of time, in milliseconds, to defer an asynchronous flush of a shared database (not open in Exclusive mode). The default when Jet is started is 0.
TuneUserCommitSync Property The Jet engine's UserCommitSync tuning value which controls whether the system waits for a commit to finish. A value of Yes (default value) instructs the system to wait; a value of No instructs the system to perform the commit asynchronously. By default, calls to the CommitTrans method of Jet cause all unwritten data within the transaction to be written to the disk before any other activity, i.e. synchronously. This is the recommended setting because you can be sure your transactions are committed or rolled back before other parts of your application continue. For performance reasons, there are some cases where you may to write transaction committals in asynchronous mode. In this mode control returns to your program immediately after you issue the CommitTrans method, and the Jet engine writes pending data in a background thread. Such a setting can result in better performance, but is not generally recommended because you cannot be sure if and when the transaction is committed to disk.
WorkgroupPath Property Sets the workgroup information file to use
WorkspaceName Property Gets the name of the workspace. This property must be set before any other operations if you want to use a workgroup other than the default.
CloseDBInWorkspace Method Closes the current open database
CloseWorkspace Method Closes the named workspace
CreateNewDatabase Method Creates a new Jet database with format, password, encryption and language options.
DatabaseCompact Method Compact a standard database that is not under workgroup security to a new database name. Compacting a database accomplishes several things: - Moves data pages for each table into adjacent locations to speed table access. - Discards unused space left over from object and record deletions, and resizes the database accordingly. - Resets the increment value for AutoNumber (counter) fields so the next number used is one more than the current highest number for each field. - Rebuilds the statistics for tables that are used to generate query optimization plans. All queries are flagged as uncompiled so the next time they run they will use the updated statistics. Compacting a database requires exclusive access to the database. If other users have the database open, or other processes or applications on your computer have the database open, the Compact operation will fail.
DatabaseCompactGeneral Method Compact the specified database. Note that Access cannot compact the current database from VBA code. Set the database's Compact on Close option to do that.
DatabaseDecrypt Method Decrypts the named database or a copy of the database Decrypting a database reverses the act of encrypting a database. For more information on database encryption, see the EncryptDatabase method of this class, or search DAO online help for "EncryptDatabase". This operation requires exclusive access to the database. If other users have the database open, or other processes or applications on your computer have the database open, the operation will fail.
DatabaseEncrypt Method Encrypts the named database to itself or to a new database Encryption is one of the security features available to Microsoft Jet databases. Encrypting a database makes the contents of the database file unreadable from external sources. Un-encrypted Jet databases contain viewable data that can be seen at the operating system level with tools such as hex editors. While the data is difficult to read (because of embedded high-order bits), it is nonetheless decipherable. On the other hand, encrypted databases are completely unreadable because every byte in the database file has been encrypted using the RSA RC4 algorithm with a 32-bit key for every 2K page. To encrypt a database, you must be logged in as a member of the Admins group of the workgroup information file that was in use when the database was created. Encrypted databases have a 10-15% performance degradation over unencrypted databases. Also, since encryption works by removing repeated patterns in data, an encrypted database is essentially uncompressible using popular compression utilities such as Zip, ARJ, and ARC. Similarly, encrypted databases take more space on compressed archives such as tape drives and compressed disk drives. Note that encrypting a database does not add any additional security as far as applications such as Access and Visual Basic are concerned--an encrypted database can be opened just like any other database without Jet user-level security. The only difference is that the database file cannot be read using external tools such as hex editors. For full data security, you must implement user-level Security. This operation requires exclusive access to the database. If other users have the database open, or other processes or applications on your computer have the database open, the operation will fail.
DatabasePasswordChange Method Change the password of a database or create a copy of the database with the new password
DatabasePasswordRemove Method Remove the password for a database or create a copy of the database without a database password
GetNamePart Private Returns the file name with extension without the leading drive and folder names. This private member supports the class.
GetNamePartNoExt Private Returns the name of a fully qualified file name with no extension. This private member supports the class.
GetPathFromFullPath Private Returns the path (drive and folders) without the file name from a fully qualified file name. This private member supports the class.
OpenDBInWorkspace Method Opens the named Access/Jet database in the class's current workspace. Use this method after creating your own workspace with the CreateWorkspace method of the class. The database that you specify will be opened in the class workspace, which essentially logs you on as the user specified when the workspace was created.
OpenWorkspace Method Creates a Jet workspace object. This is the mechanism you use to log into a secure workgroup/database. All subsequent calls to access database objects through the workspace will be constrained by the permission and group membership security active for the user you logged in as.
RefreshCache Method Forces Jet to refresh its cache Version 3 of the Jet engine included an optimization that changed the way that the shared cache was kept current. Under the new scheme, databases open in shared mode are monitored to see if any activity is happening--if not, the shared cache is not refreshed. This results in significant performance gains on shared databases, approaching the levels of databases opened exclusively. The drawback of this optimization is that users on shared databases can end up waiting up to 10 seconds before seeing changes made by other users. One way to solve this problem is the set the PageTimeout registry setting (see the TunePageTimeout property in this class for details) to a lower value, but this causes performance degradation for other Jet operations. The best solution to this problem is to use the class RefreshCache method. This method calls the DAO.DBEngine.Idle method with the new (as of Jet 3.5) dbRefreshCache constant. Call this method when you want to make other user's changes visible. Don't call this method unnecessarily, or increased network and disk activity will occur.
ResetISAMCacheReads Method Resets the Jet engine Cache Reads statistic
ResetISAMDiskReads Method Resets the Jet engine Disk Reads statistic. When you start the Jet engine, it keeps various statistics updated. These ISAM statistics are continually updated and the values accumulate. Use this method to reset this specific statistic to 0. This is typically done when you are about to start an operation and you want to see the statistics for that specific operation.
ResetISAMDiskWrites Method Resets the Jet engine Disk Writes statistic When you start the Jet engine, it keeps various statistics updated. These ISAM statistics are continually updated and the values accumulate. Use this method to reset this specific statistic to 0. This is typically done when you are about to start an operation and you want to see the statistics for that specific operation.
ResetISAMLocksPlaced Method Resets the Jet engine Locks Placed statistic When you start the Jet engine, it keeps various statistics updated. These ISAM statistics are continually updated and the values accumulate. Use this method to reset this specific statistic to 0. This is typically done when you are about to start an operation and you want to see the statistics for that specific operation.
ResetISAMLocksReleased Method Resets the Jet engine Locks Released statistic When you start the Jet engine, it keeps various statistics updated. These ISAM statistics are continually updated and the values accumulate. Use this method to reset this specific statistic to 0. This is typically done when you are about to start an operation and you want to see the statistics for that specific operation.
ResetISAMRACacheReads Method Resets the Jet engine ReadAhead Cache Reads statistic When you start the Jet engine, it keeps various statistics updated. These ISAM statistics are continually updated and the values accumulate. Use this method to reset this specific statistic to 0. This is typically done when you are about to start an operation and you want to see the statistics for that specific operation.
TransactionCommit Method Commits the current transaction.
TransactionRollback Method Rolls the current transaction back
TransactionStart Method Starts a transaction in the current workspace. Note that a workspace needs to be started with the OpenWorkspace method.

Overview of Total Visual SourceBook

The source code in Total Visual SourceBook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.

Additional Resources

Feedback

Contact Us  l   Web questions: Webmaster   l   Copyright © FMS, Inc., Vienna, Virginia
Celebrating our 26th Year of Software Excellence