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
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_dotnet53 (in libdb_dotnet53.dll) Version: 5.3.21.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.

It is important to understand that flushing cached information to disk only minimizes the window of opportunity for corrupted data. Although unlikely, it is possible for database corruption to happen if a system or application crash occurs 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 once all applications using the database have successfully called Close, atomically replace the original database with the updated copy.

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

# See Also

BaseDatabase Class
Close Overload
BerkeleyDB Namespace