<xml></xml>

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

Berkeley DB .NET API Documentation
BaseDatabase..::.Close Method (Boolean)
BaseDatabase Class See Also Send Feedback

Optionally flush any cached database information to disk, close any open Cursor()()() objects, free any allocated resources, and close any underlying files.

Namespace: BerkeleyDB
Assembly: libdb_dotnet60 (in libdb_dotnet60.dll) Version: 6.0.30.0

# Syntax

C#

    public void Close(
    	bool sync
    )

Visual Basic (Declaration)

    Public Sub Close ( _
    	sync As Boolean _
    )

Visual C++

    public:
    void Close(
    	bool sync
    )

#### Parameters

sync
  Type: System..::.Boolean
  If false, do not flush cached information to disk.

# Remarks

The sync parameter is a dangerous option. It should be set to false only if the application is doing logging (with transactions) so that the database is recoverable after a system or application crash, or if the database is always generated from scratch after any system or application crash.

Flushing cached information to disk only minimizes the window of opportunity for corrupted data. Although unlikely, it is possible for database corruption to occur in the event of a system or application crash while writing data to the database. To ensure that database corruption never occurs, applications must either use transactions and logging with automatic recovery, or edit a copy of the database and then replace the corrupted database with the updated copy once all applications using the database have successfully called Close()()().

Note that this parameter only works when the database has been opened using an environment.

# See Also

BaseDatabase Class
Close Overload
BerkeleyDB Namespace