Library Version 18.1.25

DB_ENV->set_ext_file_dir()
Prev | Chapter 13. External Files | Next

## DB_ENV->set_ext_file_dir()

    #include <db.h>

    int
    DB_ENV->set_ext_file_dir(DB_ENV *dbenv, const char *dir);

The `DB_ENV->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 DB_ENV->get_ext_file_dir() to identify the current storage location used for external file data.

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

This method may not be called after DB_ENV->open() is called.

Unless otherwise specified, the `DB_ENV->set_ext_file_dir()` method returns a non-zero error value on failure and 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 `DB_ENV->set_ext_file_dir()` method may fail and 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

DB_ENV

### See Also

External Files and Related Methods

Prev | Up | Next
DB_ENV->get_ext_file_threshold() | Home | DB_ENV->set_ext_file_threshold()