Library Version 12.1.6.2

DbEnv::set_ext_file_dir()
Prev | Chapter 14. External Files | Next

## DbEnv::set_ext_file_dir()

    #include <db_cxx.h>

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

The `DbEnv::set_ext_file_dir()` method sets the directory where external file data is stored. Use this method when the database is opened within an encompassing environment. If an environment is not in use, use Db::set_ext_file_dir() instead.

By default, if this method is not called then external file data is placed in a subdirectory within the DB's environment.

Once this method has been used, you can call DbEnv::get_ext_file_dir() to identify the current storage location used for external file data.

This method configures operations performed using the specified DbEnv handle, not all operations performed on the underlying database environment.

This method may not be called after DbEnv::open() is called.

Unless otherwise specified, the `DbEnv::set_ext_file_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

Provides the name of the directory where external file data is to be stored. If an absolute path is not provided, then the directory identified here is relative to the environment's home directory.

### Errors

The `DbEnv::set_ext_file_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:

#### EINVAL

If the method was called after Db::open() was called; or if an invalid parameter was specified.

### Class

DbEnv

### See Also

External Files and Related Methods

Prev | Up | Next
DbEnv::get_ext_file_threshold() | Home | DbEnv::set_ext_file_threshold()