Library Version 18.1.40

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

## Db::set_ext_file_dir()

    #include <db_cxx.h>

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

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

By default, if this method is not called then external file data is placed in a directory local to the current working directory.

Use Db::get_ext_file_dir() to identify the current storage location used for external file data.

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

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

Unless otherwise specified, the `Db::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 current working directory.

### Errors

The `Db::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 database was opened within a named environment; or if the method was called after Db::open() was called; or if an invalid parameter was specified.

### Class

Db

### See Also

External Files and Related Methods

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