Initiate the beginning of a two-phase commit.

Namespace:  BerkeleyDB
Assembly:  libdb_dotnet52 (in libdb_dotnet52.dll) Version:


public void Prepare(
	byte[] globalId
Visual Basic (Declaration)
Public Sub Prepare ( _
	globalId As Byte() _
Visual C++
void Prepare(
	array<unsigned char>^ globalId


Type: array< System..::.Byte >[]()[]
The global transaction ID by which this transaction will be known. This global transaction ID will be returned in calls to Recover(Int32, Boolean) telling the application which global transactions must be resolved.


In a distributed transaction environment, Berkeley DB can be used as a local transaction manager. In this case, the distributed transaction manager must send prepare messages to each local manager. The local manager must then call Prepare and await its successful return before responding to the distributed transaction manager. Only after the distributed transaction manager receives successful responses from all of its prepare messages should it issue any commit messages.

In the case of nested transactions, preparing the parent causes all unresolved children of the parent transaction to be committed. Child transactions should never be explicitly prepared. Their fate will be resolved along with their parent's during global recovery.

If there are cursor handles open when this method is called, they are all closed inside this method. And if there are errors when closing the cursor handles, the first such error is returned.

See Also