Library Version 18.1.40

DB->set_create_dir()
Prev | Chapter 2. The DB Handle | Next

## DB->set_create_dir()

    #include <db.h>

    int
    DB->set_create_dir(DB *db, const char *dir);

Specify which directory a database should be created in or looked for.

The `DB->set_create_dir()` method may not be called after the DB->open() method is called.

The `DB->set_create_dir()` method returns a non-zero error value on failure and 0 on success.

### Parameters

#### dir

The dir will be used to create or locate the database file specified in the DB->open() method call. The directory must be one of the directories in the environment list specified by DB_ENV->add_data_dir() .

### Errors

The `DB->set_create_dir()` method may fail and return one of the following non-zero errors:

#### EINVAL

An invalid flag value or parameter was specified.

### Class

DB

### See Also

Database and Related Methods

Prev | Up | Next
DB->set_cachesize() | Home | DB->set_dup_compare()