1<!--$Id: env_set_data_dir.so,v 10.28 2004/09/28 15:04:20 bostic Exp $--> 2<!--Copyright (c) 1997,2008 Oracle. All rights reserved.--> 3<!--See the file LICENSE for redistribution information.--> 4<html> 5<head> 6<title>Berkeley DB: DB_ENV->set_data_dir</title> 7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> 8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> 9</head> 10<body bgcolor=white> 11<table width="100%"><tr valign=top> 12<td> 13<b>DB_ENV->set_data_dir</b> 14</td> 15<td align=right> 16<a href="/api_c/api_core.html"><img src="/images/api.gif" alt="API"></a> 17<a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a></td> 18</tr></table> 19<hr size=1 noshade> 20<tt> 21<b><pre> 22#include <db.h> 23<p> 24int 25DB_ENV->set_data_dir(DB_ENV *dbenv, const char *dir); 26<p> 27int 28DB_ENV->get_data_dirs(DB_ENV *dbenv, const char ***dirpp); 29</pre></b> 30<hr size=1 noshade> 31<b>Description: DB_ENV->set_data_dir</b> 32<p>Set the path of a directory to be used as the location of the access 33method database files. Paths specified to the <a href="/api_c/db_open.html">DB->open</a> function 34will be searched relative to this path. Paths set using this method 35are additive, and specifying more than one will result in each specified 36directory being searched for database files. If any directories are 37specified, created database files will always be created in the first 38path specified.</p> 39<p>If no database directories are specified, database files must be named 40either by absolute paths or relative to the environment home directory. 41See <a href="/ref/env/naming.html">Berkeley DB File Naming</a> for more 42information.</p> 43<p>The database environment's data directories may also be configured using the 44environment's <a href="/ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file. The syntax of the entry in that 45file is a single line with the string "set_data_dir", one or more whitespace 46characters, and the directory name. 47</p> 48<p>The DB_ENV->set_data_dir method configures operations performed using the specified 49<a href="/api_c/env_class.html">DB_ENV</a> handle, not all operations performed on the underlying 50database environment.</p> 51<p>The DB_ENV->set_data_dir method may not be called after the <a href="/api_c/env_open.html">DB_ENV->open</a> method is 52called. 53If the database environment already exists when 54<a href="/api_c/env_open.html">DB_ENV->open</a> is called, the information specified to DB_ENV->set_data_dir 55must be consistent with the existing environment or corruption can 56occur.</p> 57<p>The DB_ENV->set_data_dir method 58returns a non-zero error value on failure 59and 0 on success. 60</p> 61<b>Parameters</b> <br> 62 <b>dir</b><ul compact><li>The <b>dir</b> parameter is a directory to be used as a location for 63database files.</ul> 64<p>When using a Unicode build on Windows (the default), the <b>dir</b> 65argument will be interpreted as a UTF-8 string, which is equivalent to 66ASCII for Latin characters.</p> 67<br> 68<br><b>Errors</b> 69<p>The DB_ENV->set_data_dir method 70may fail and return one of the following non-zero errors:</p> 71<br> 72<b>EINVAL</b><ul compact><li>If the method was called after <a href="/api_c/env_open.html">DB_ENV->open</a> was called; or if an 73invalid flag value or parameter was specified.</ul> 74<br> 75<hr size=1 noshade> 76<b>Description: DB_ENV->get_data_dirs</b> 77<p>The DB_ENV->get_data_dirs method returns the NULL-terminated array of directories.</p> 78<p>The DB_ENV->get_data_dirs method may be called at any time during the life of the 79application.</p> 80<p>The DB_ENV->get_data_dirs method 81returns a non-zero error value on failure 82and 0 on success. 83</p> 84<b>Parameters</b> <br> 85 <b>dirpp</b><ul compact><li>The DB_ENV->get_data_dirs method returns a reference to the 86NULL-terminated array of directories in <b>dirpp</b>.</ul> 87<br> 88<hr size=1 noshade> 89<br><b>Class</b> 90<a href="/api_c/env_class.html">DB_ENV</a> 91<br><b>See Also</b> 92<a href="/api_c/env_list.html">Database Environments and Related Methods</a> 93</tt> 94<table width="100%"><tr><td><br></td><td align=right> 95<a href="/api_c/api_core.html"><img src="/images/api.gif" alt="API"></a><a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a> 96</td></tr></table> 97<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 98</body> 99</html> 100