Collapse All Expand All Code: All Code: Multiple Code: C# Code: Visual Basic Code: Visual C++

C#
Visual Basic
Visual C++

Berkeley DB .NET API Documentation
DatabaseEnvironment..::.Close Method
DatabaseEnvironment Class See Also

Close the Berkeley DB environment, freeing any allocated resources and closing any underlying subsystems.

Namespace: BerkeleyDB
Assembly: libdb_dotnet48 (in libdb_dotnet48.dll) Version: 4.8.24.0

# Syntax

C#
    public void Close()

Visual Basic (Declaration)
    Public Sub Close

Visual C++
    public:
    void Close()

# Remarks

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 database objects remain open, or transactions in the environment have not yet been committed or aborted.

Where the environment was configured with UseTxns, calling Close 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 Close, 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 Close.

# See Also

DatabaseEnvironment Class
BerkeleyDB Namespace