Close the Berkeley DB environment, freeing any allocated resources, closing any open databases as well as underlying subsystems.

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


public void CloseForceSync()
Visual Basic (Declaration)
Public Sub CloseForceSync
Visual C++
void CloseForceSync()


The object should not be closed while any other handle that refers to it is not yet closed; for example, database environment handles must not be closed while transactions in the environment have not yet been committed or aborted. If there are open database handles, they are all closed, and each of them will be synced on close. The first error in the close operations, if any, is returned at last, and the environment close procedures will carry on anyway.

Where the environment was configured with UseTxns, calling CloseForceSync aborts any unresolved transactions. Applications should not depend on this behavior for transactions involving Berkeley DB databases; all such transactions should be explicitly resolved. The problem with depending on this semantic is that aborting an unresolved transaction involving database operations requires a database handle. Because the database handles should have been closed before calling CloseForceSync, it will not be possible to abort the transaction, and recovery will have to be run on the Berkeley DB environment before further operations are done.

In multithreaded applications, only a single thread may call CloseForceSync.

See Also