Library Version 12.1.6.2

Db::set_create_dir()
Prev | Chapter 2. The Db Handle | Next

## Db::set_create_dir()

    #include <db_cxx.h>

    int
    Db::set_create_dir(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 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

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 DbEnv::add_data_dir().

### Errors

The `Db::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:

#### 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()