Last modified: January 09, 2012
Applies to: Windows | Windows Server
The JetTerm function initiates the shutdown of an instance that has been initialized by JetInit.
JetTerm can also be used to destroy an uninitialized instance that was created by JetCreateInstance.
JET_ERR JET_API JetTerm( __in JET_INSTANCE instance );
Specifies the instance to use for this call.
Windows 2000: This parameter is ignored and should always be NULL.
Windows XP and later releases: This parameter is overloaded. If the engine is operating in legacy mode (Windows 2000 compatibility mode) where only one instance is supported, then this parameter might be NULL or might contain the actual instance that is returned by JetInit. If the engine is operating in multi-instance mode, then this parameter must be a pointer to an instance that was created using JetCreateInstance.
This function returns the JET_ERR datatype with one of the following return codes. For more information about the possible ESE errors, see Extensible Storage Engine Errors and Error Handling Parameters.
The operation completed successfully.
One of the parameters that was provided contained an unexpected value, or the combination of several parameters yielded an unexpected result. This error will be returned by JetTerm when the engine is in multi-instance mode and when pinstance refers to an invalid instance.
Windows XP: This return value is introduced in Windows XP.
The operation cannot complete because the instance has not yet been initialized.
The operation cannot complete because the instance is being shut down.
It is not possible to complete the operation because a restore operation is in progress on the instance.
The operation cannot complete because a backup operation is in progress on the instance.
The instance cannot be shut down because there are currently sessions with active transactions for the specified instance. This error occurs only if the JET_bitTermComplete is used.
If this function succeeds, the specified instance will be shut down. The instance handle will also be closed and made unavailable to any API that takes an instance handle. All other objects that are associated with the instance, such as sessions, will also be closed. The state of the checkpoint file, transaction log files, and the database files attached to the instance will be modified during the shutdown process.
If this function fails as the result of a usage error, then the instance remains in an initialized state and nothing changes. Otherwise, the instance is still shut down as per the success case. The difference is that the instance will need to go through crash recovery when it is next initialized. The engine will try to flush as much data as possible to minimize the amount of recovery that is required. Conceptually, such a failure of JetTerm is no different than a process crash.
If the host process of an instance quits for any reason before JetTerm is successfully called on that instance then the instance is considered to be in a crashed state. Crash recovery will occur on the next attempt to initialize that instance.
Requires Windows Vista, Windows XP, or Windows 2000 Professional.
Requires Windows Server 2008, Windows Server 2003, or Windows 2000 Server.
Declared in Esent.h.