#include <db_cxx.h> int DbEnv::set_create_dir(const char *dir);
Sets the path of a directory to be used as the location to create the access method database files. When the Db::open() function is used to create a file it will be created relative to this path.
If no database directories are specified, database files will be created either by absolute paths or relative to the environment home directory. See Berkeley DB File Naming for more information.
The database environment's create 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_create_dir", one or more whitespace characters, and the directory name.
The DbEnv::set_create_dir()
method configures operations performed
using the specified DbEnv
handle, not all operations performed on the underlying database environment.
The DbEnv::set_create_dir()
method may be called at any time.
The DbEnv::set_create_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.
The dir parameter is a directory to be used to create database files. This directory must be one of the directories specified via a call to DbEnv::add_data_dir()
When using a Unicode build on Windows (the default), this argument will be interpreted as a UTF-8 string, which is equivalent to ASCII for Latin characters.
The DbEnv::set_create_dir()
method may fail and throw a DbException
exception, encapsulating one of the following non-zero errors, or return one
of the following non-zero errors:
If the method was called after DbEnv::open() was called; or if an invalid flag value or parameter was specified.