DbEnv::set_metadata_dir()

#include <db_cxx.h>

int
DbEnv::set_metadata_dir(const char *dir);

The DbEnv::set_metadata_dir() method sets the directory where persistent metadata is stored. By default, persistent metadata is stored in the environment home directory.

When used in a replicated application, the metadata directory must be the same location for all sites within a replication group.

The DbEnv::set_metadata_dir() method may not be called after the DbEnv::open() method is called. The directory identified by this method must already exist when the DbEnv::open() method is called. The directory identified by this method is added to the environment's list of data directories, if this directory is not already included on that list.

The database environment's metadata directory may also be configured using the environment's DB_CONFIG file. The syntax of the entry in that file is a single line with the string "set_metadata_dir", one or more whitespace characters, followed by the directory location. Because the DB_CONFIG file is read when the database environment is opened, it will silently overrule configuration done before that time.

The DbEnv::set_metadata_dir() method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 0 on success.

Parameters

dir

The dir parameter identifies the directory used to store persistent metadata files.

Class

DbEnv

See Also

Database Environments and Related Methods, DbEnv::get_metadata_dir()