| 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 4 | <head> |
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 6 | <title>Db::open()</title> |
| 7 | <link rel="stylesheet" href="apiReference.css" type="text/css" /> |
| 8 | <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> |
| 9 | <link rel="start" href="index.html" title="Berkeley DB C++ API Reference" /> |
| 10 | <link rel="up" href="db.html" title="Chapter 2. The Db Handle" /> |
| 11 | <link rel="prev" href="dbkey_range.html" title="Db::key_range()" /> |
| 12 | <link rel="next" href="dbput.html" title="Db::put()" /> |
| 13 | </head> |
| 14 | <body> |
| 15 | <div xmlns="" class="navheader"> |
| 16 | <div class="libver"> |
| 17 | <p>Library Version 11.2.5.3</p> |
| 18 | </div> |
| 19 | <table width="100%" summary="Navigation header"> |
| 20 | <tr> |
| 21 | <th colspan="3" align="center">Db::open()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="dbkey_range.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 2. |
| 26 | The Db Handle |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="dbput.html">Next</a></td> |
| 29 | </tr> |
| 30 | </table> |
| 31 | <hr /> |
| 32 | </div> |
| 33 | <div class="sect1" lang="en" xml:lang="en"> |
| 34 | <div class="titlepage"> |
| 35 | <div> |
| 36 | <div> |
| 37 | <h2 class="title" style="clear: both"><a id="dbopen"></a>Db::open()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db_cxx.h> |
| 42 | |
| 43 | int |
| 44 | Db::open(DbTxn *txnid, const char *file, |
| 45 | const char *database, DBTYPE type, u_int32_t flags, int mode); </pre> |
| 46 | <p> |
| 47 | The <code class="methodname">Db::open()</code> method opens the database represented by the |
| 48 | <span class="bold"><strong>file</strong></span> and <span class="bold"><strong>database</strong></span>. |
| 49 | </p> |
| 50 | <p> |
| 51 | The currently supported Berkeley DB file formats (or <span class="emphasis"><em>access |
| 52 | methods</em></span>) are Btree, Hash, Heap, Queue, and Recno. The Btree |
| 53 | format is a representation of a sorted, balanced tree structure. The |
| 54 | Hash format is an extensible, dynamic hashing scheme. The Queue |
| 55 | format supports fast access to fixed-length records accessed |
| 56 | sequentially or by logical record number. The Recno format supports |
| 57 | fixed- or variable-length records, accessed sequentially or by logical |
| 58 | record number, and optionally backed by a flat text file. |
| 59 | </p> |
| 60 | <p> |
| 61 | Storage and retrieval for the Berkeley DB access methods are based on |
| 62 | key/data pairs; see <a class="link" href="dbt.html" title="Chapter 4. The Dbt Handle">Dbt</a> |
| 63 | for more information. |
| 64 | </p> |
| 65 | <p> |
| 66 | Calling <code class="methodname">Db::open()</code> is a relatively expensive operation, and |
| 67 | maintaining a set of open databases will normally be preferable to |
| 68 | repeatedly opening and closing the database for each new query. |
| 69 | </p> |
| 70 | <p> |
| 71 | The <code class="methodname">Db::open()</code> <span> |
| 72 | |
| 73 | <span> |
| 74 | method either returns a non-zero error value or throws an |
| 75 | exception that encapsulates a non-zero error value on |
| 76 | failure, and returns 0 on success. |
| 77 | </span> |
| 78 | </span> |
| 79 | If <code class="methodname">Db::open()</code> fails, the |
| 80 | <a class="xref" href="dbclose.html" title="Db::close()">Db::close()</a> method must be |
| 81 | called to discard the <a class="link" href="db.html" title="Chapter 2. The Db Handle">Db</a> |
| 82 | handle. |
| 83 | </p> |
| 84 | <div class="sect2" lang="en" xml:lang="en"> |
| 85 | <div class="titlepage"> |
| 86 | <div> |
| 87 | <div> |
| 88 | <h3 class="title"><a id="idp491712"></a>Parameters</h3> |
| 89 | </div> |
| 90 | </div> |
| 91 | </div> |
| 92 | <div class="sect3" lang="en" xml:lang="en"> |
| 93 | <div class="titlepage"> |
| 94 | <div> |
| 95 | <div> |
| 96 | <h4 class="title"><a id="idm1637216"></a>txnid</h4> |
| 97 | </div> |
| 98 | </div> |
| 99 | </div> |
| 100 | <p> |
| 101 | If the operation is part of an application-specified |
| 102 | transaction, the <span class="bold"><strong>txnid</strong></span> |
| 103 | parameter is a transaction handle returned from |
| 104 | <a class="xref" href="txnbegin.html" title="DbEnv::txn_begin()">DbEnv::txn_begin()</a>; if |
| 105 | the operation is part of a Berkeley DB Concurrent Data |
| 106 | Store group, the |
| 107 | <span class="bold"><strong>txnid</strong></span> parameter is a |
| 108 | handle returned from |
| 109 | <a class="xref" href="envcdsgroup_begin.html" title="DbEnv::cdsgroup_begin()">DbEnv::cdsgroup_begin()</a>; |
| 110 | otherwise NULL. If no transaction handle is specified, |
| 111 | but the DB_AUTO_COMMIT flag is specified, the operation |
| 112 | will be implicitly transaction protected. Note that |
| 113 | transactionally protected operations on a |
| 114 | <a class="link" href="db.html" title="Chapter 2. The Db Handle">Db</a> handle requires the |
| 115 | <a class="link" href="db.html" title="Chapter 2. The Db Handle">Db</a> handle itself be |
| 116 | transactionally protected during its open. Also note |
| 117 | that the transaction must be committed before the handle |
| 118 | is closed; see |
| 119 | <a href="../../programmer_reference/program_scope.html" class="olink">Berkeley DB handles</a> |
| 120 | for more information. |
| 121 | </p> |
| 122 | </div> |
| 123 | <div class="sect3" lang="en" xml:lang="en"> |
| 124 | <div class="titlepage"> |
| 125 | <div> |
| 126 | <div> |
| 127 | <h4 class="title"><a id="idm828008"></a>file</h4> |
| 128 | </div> |
| 129 | </div> |
| 130 | </div> |
| 131 | <p> |
| 132 | The <span class="bold"><strong>file</strong></span> parameter is used as the |
| 133 | name of an underlying file that will be used to back the database; see |
| 134 | <a href="../../programmer_reference/env_naming.html" class="olink">File naming</a> for more |
| 135 | information. |
| 136 | </p> |
| 137 | <p> |
| 138 | In-memory databases never intended to be preserved on disk may be |
| 139 | created by setting the <span class="bold"><strong>file</strong></span> parameter |
| 140 | to NULL. Whether other threads of control can access this database is |
| 141 | driven entirely by whether the <span class="bold"><strong>database</strong></span> |
| 142 | parameter is set to NULL. |
| 143 | </p> |
| 144 | <p> |
| 145 | When using a Unicode build on Windows (the default), the <span class="bold"><strong>file</strong></span> argument will be interpreted as a UTF-8 |
| 146 | string, which is equivalent to ASCII for Latin characters. |
| 147 | </p> |
| 148 | </div> |
| 149 | <div class="sect3" lang="en" xml:lang="en"> |
| 150 | <div class="titlepage"> |
| 151 | <div> |
| 152 | <div> |
| 153 | <h4 class="title"><a id="idp3930776"></a>database</h4> |
| 154 | </div> |
| 155 | </div> |
| 156 | </div> |
| 157 | <p> |
| 158 | The <span class="bold"><strong>database</strong></span> parameter is optional, |
| 159 | and allows applications to have multiple databases in a single file. |
| 160 | Although no <span class="bold"><strong>database</strong></span> parameter needs |
| 161 | to be specified, it is an error to attempt to open a second database |
| 162 | in a <span class="bold"><strong>file</strong></span> that was not initially |
| 163 | created using a <span class="bold"><strong>database</strong></span> name. |
| 164 | Further, the <span class="bold"><strong>database</strong></span> parameter is |
| 165 | not supported by the Queue format. Finally, when opening multiple |
| 166 | databases in the same physical file, it is important to consider |
| 167 | locking and memory cache issues; see |
| 168 | <a href="../../programmer_reference/am_opensub.html" class="olink">Opening multiple databases in a single file</a> |
| 169 | for more information. |
| 170 | </p> |
| 171 | <p> |
| 172 | If both the <span class="bold"><strong>database</strong></span> and |
| 173 | <span class="bold"><strong>file</strong></span> parameters are NULL, |
| 174 | the database is strictly temporary and cannot be opened |
| 175 | by any other thread of control. Thus the database can only be accessed |
| 176 | by sharing the single database handle that created it, in |
| 177 | circumstances where doing so is safe. |
| 178 | </p> |
| 179 | <p> |
| 180 | If the <span class="bold"><strong>database</strong></span> parameter is not |
| 181 | set to NULL, the database can be opened by other threads of control |
| 182 | and will be replicated to client sites in any replication group, regardless |
| 183 | of whether the <span class="bold"><strong>file</strong></span> parameter is set to |
| 184 | NULL. |
| 185 | </p> |
| 186 | </div> |
| 187 | <div class="sect3" lang="en" xml:lang="en"> |
| 188 | <div class="titlepage"> |
| 189 | <div> |
| 190 | <div> |
| 191 | <h4 class="title"><a id="idp262560"></a>type</h4> |
| 192 | </div> |
| 193 | </div> |
| 194 | </div> |
| 195 | <p> |
| 196 | The <span class="bold"><strong>type</strong></span> parameter is of |
| 197 | type DBTYPE, and must be set to one of |
| 198 | <code class="literal">DB_BTREE</code>, <code class="literal">DB_HASH</code>, |
| 199 | <code class="literal">DB_HEAP</code>, <code class="literal">DB_QUEUE</code>, |
| 200 | <code class="literal">DB_RECNO</code>, or <code class="literal">DB_UNKNOWN</code>. |
| 201 | If <span class="bold"><strong>type</strong></span> is DB_UNKNOWN, the |
| 202 | database must already exist and |
| 203 | <code class="methodname">Db::open()</code> will automatically |
| 204 | determine its type. The |
| 205 | <a class="xref" href="dbget_type.html" title="Db::get_type()">Db::get_type()</a> method |
| 206 | may be used to determine the underlying type of databases opened using |
| 207 | DB_UNKNOWN. |
| 208 | </p> |
| 209 | <p> |
| 210 | It is an error to specify the incorrect <span class="bold"><strong>type</strong></span> |
| 211 | for a database that already exists. |
| 212 | </p> |
| 213 | </div> |
| 214 | <div class="sect3" lang="en" xml:lang="en"> |
| 215 | <div class="titlepage"> |
| 216 | <div> |
| 217 | <div> |
| 218 | <h4 class="title"><a id="idp359520"></a>flags</h4> |
| 219 | </div> |
| 220 | </div> |
| 221 | </div> |
| 222 | <p> |
| 223 | The <span class="bold"><strong>flags</strong></span> parameter must be set to zero or |
| 224 | by bitwise inclusively <span class="bold"><strong>OR</strong></span>'ing together one |
| 225 | or more of the following values: |
| 226 | </p> |
| 227 | <div class="itemizedlist"> |
| 228 | <ul type="disc"> |
| 229 | <li> |
| 230 | <p><a id="open_DB_AUTO_COMMIT"></a> |
| 231 | <code class="literal">DB_AUTO_COMMIT</code> |
| 232 | </p> |
| 233 | <p> |
| 234 | Enclose the <code class="methodname">Db::open()</code> |
| 235 | call within a transaction. If the call succeeds, |
| 236 | the open operation will be recoverable and all |
| 237 | subsequent database modification operations based |
| 238 | on this handle will be transactionally protected. |
| 239 | If the call fails, no database will have been |
| 240 | created. |
| 241 | </p> |
| 242 | </li> |
| 243 | <li> |
| 244 | <p><a id="open_DB_CREATE"></a> |
| 245 | <code class="literal">DB_CREATE</code> |
| 246 | </p> |
| 247 | <p> |
| 248 | Create the database. If the database does not |
| 249 | already exist and the <code class="literal">DB_CREATE</code> |
| 250 | flag is not specified, the |
| 251 | <code class="methodname">Db::open()</code> will fail. |
| 252 | </p> |
| 253 | </li> |
| 254 | <li> |
| 255 | <p><a id="open_DB_EXCL"></a> |
| 256 | <code class="literal">DB_EXCL</code> |
| 257 | </p> |
| 258 | <p> |
| 259 | Return an error if the database already exists. The |
| 260 | <code class="literal">DB_EXCL</code> flag is only meaningful |
| 261 | when specified with the <code class="literal">DB_CREATE</code>. |
| 262 | flag. |
| 263 | </p> |
| 264 | </li> |
| 265 | <li> |
| 266 | <p><a id="dbopen_DB_MULTIVERSION"></a> |
| 267 | <code class="literal">DB_MULTIVERSION</code> |
| 268 | </p> |
| 269 | <p> |
| 270 | Open the database with support for |
| 271 | <a href="../../programmer_reference/transapp_read.html" class="olink"> |
| 272 | multiversion concurrency control</a>. |
| 273 | This will cause updates to the database to follow a |
| 274 | copy-on-write protocol, which is required to |
| 275 | support snapshot isolation. The |
| 276 | <code class="literal">DB_MULTIVERSION</code> flag requires |
| 277 | that the database be transactionally protected |
| 278 | during its open and is not supported by the queue |
| 279 | format. |
| 280 | </p> |
| 281 | </li> |
| 282 | <li> |
| 283 | <p><a id="open_DB_NOMMAP"></a> |
| 284 | <code class="literal">DB_NOMMAP</code> |
| 285 | </p> |
| 286 | <p> |
| 287 | Do not map this database into process memory (see the |
| 288 | <a class="xref" href="envset_mp_mmapsize.html" title="DbEnv::set_mp_mmapsize()">DbEnv::set_mp_mmapsize()</a> |
| 289 | method for further information). |
| 290 | </p> |
| 291 | </li> |
| 292 | <li> |
| 293 | <p><a id="dbopen_DB_RDONLY"></a> |
| 294 | <code class="literal">DB_RDONLY</code> |
| 295 | </p> |
| 296 | <p> |
| 297 | Open the database for reading only. Any attempt to modify |
| 298 | items in the database will fail, regardless of the actual |
| 299 | permissions of any underlying files. |
| 300 | </p> |
| 301 | </li> |
| 302 | <li> |
| 303 | <p><a id="dbopen_DB_READ_UNCOMMITTED"></a> |
| 304 | <code class="literal">DB_READ_UNCOMMITTED</code> |
| 305 | </p> |
| 306 | <p> |
| 307 | Support transactional read operations with degree 1 |
| 308 | isolation. Read operations on the database may request the |
| 309 | return of modified but not yet committed data. This flag |
| 310 | must be specified on all |
| 311 | <a class="link" href="db.html" title="Chapter 2. The Db Handle">Db</a> |
| 312 | handles used to perform dirty |
| 313 | reads or database updates, otherwise requests for dirty |
| 314 | reads may not be honored and the read may block. |
| 315 | </p> |
| 316 | </li> |
| 317 | <li> |
| 318 | <p><a id="open_DB_THREAD"></a> |
| 319 | <code class="literal">DB_THREAD</code> |
| 320 | </p> |
| 321 | <p> |
| 322 | Cause the <a class="link" href="db.html" title="Chapter 2. The Db Handle">Db</a> |
| 323 | handle returned by |
| 324 | <code class="methodname">Db::open()</code> to be |
| 325 | <span class="emphasis"><em>free-threaded</em></span>; that is, |
| 326 | concurrently usable by multiple threads in the |
| 327 | address space. |
| 328 | </p> |
| 329 | <p> |
| 330 | Note that this flag is incompatible with the |
| 331 | <a class="link" href="dbset_lk_exclusive.html" title="Db::set_lk_exclusive()">Db::set_lk_exclusive()</a> |
| 332 | method. |
| 333 | </p> |
| 334 | </li> |
| 335 | <li> |
| 336 | <p><a id="open_DB_TRUNCATE"></a> |
| 337 | <code class="literal">DB_TRUNCATE</code> |
| 338 | </p> |
| 339 | <p> |
| 340 | Physically truncate the underlying file, discarding all |
| 341 | previous databases it might have held. Underlying filesystem |
| 342 | primitives are used to implement this flag. For this reason, |
| 343 | it is applicable only to the file and cannot be used to |
| 344 | discard databases within a file. |
| 345 | </p> |
| 346 | <p> |
| 347 | The <code class="literal">DB_TRUNCATE</code> flag cannot be lock or |
| 348 | transaction-protected, and it is an error to specify it in a |
| 349 | locking or transaction-protected environment. |
| 350 | </p> |
| 351 | </li> |
| 352 | </ul> |
| 353 | </div> |
| 354 | </div> |
| 355 | <div class="sect3" lang="en" xml:lang="en"> |
| 356 | <div class="titlepage"> |
| 357 | <div> |
| 358 | <div> |
| 359 | <h4 class="title"><a id="idm2072568"></a>mode</h4> |
| 360 | </div> |
| 361 | </div> |
| 362 | </div> |
| 363 | <p> |
| 364 | On Windows systems, the mode parameter is ignored. |
| 365 | </p> |
| 366 | <p> |
| 367 | On UNIX systems or in IEEE/ANSI Std 1003.1 (POSIX) environments, files |
| 368 | created by the database open are created with mode <span class="bold"><strong>mode</strong></span> (as described in <span class="bold"><strong>chmod</strong></span>(2)) and modified by the process' umask |
| 369 | value at the time of creation (see <span class="bold"><strong>umask</strong></span>(2)). Created files are owned by the |
| 370 | process owner; the group ownership of created files is based on the |
| 371 | system and directory defaults, and is not further specified by |
| 372 | Berkeley DB. System shared memory segments created by the database |
| 373 | open are created with mode <span class="bold"><strong>mode</strong></span>, |
| 374 | unmodified by the process' umask value. If <span class="bold"><strong>mode</strong></span> is 0, the database open will use a default |
| 375 | mode of readable and writable by both owner and group. |
| 376 | </p> |
| 377 | </div> |
| 378 | </div> |
| 379 | <div class="sect2" lang="en" xml:lang="en"> |
| 380 | <div class="titlepage"> |
| 381 | <div> |
| 382 | <div> |
| 383 | <h3 class="title"><a id="idm2077472"></a>Environment Variables</h3> |
| 384 | </div> |
| 385 | </div> |
| 386 | </div> |
| 387 | <p> |
| 388 | If the database was opened within a database environment, the |
| 389 | environment variable <span class="bold"><strong>DB_HOME</strong></span> |
| 390 | may be used as the path of the database environment home. |
| 391 | </p> |
| 392 | <p> |
| 393 | <code class="methodname">Db::open()</code> is affected by any |
| 394 | database directory specified using the |
| 395 | <a class="xref" href="envset_data_dir.html" title="DbEnv::set_data_dir()">DbEnv::set_data_dir()</a> |
| 396 | method, or by setting the "set_data_dir" string in the |
| 397 | environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. |
| 398 | </p> |
| 399 | <div class="itemizedlist"> |
| 400 | <ul type="disc"> |
| 401 | <li> |
| 402 | <p> |
| 403 | <span class="bold"><strong>TMPDIR</strong></span> |
| 404 | </p> |
| 405 | <p> |
| 406 | If the <span class="bold"><strong>file</strong></span> and |
| 407 | <span class="bold"><strong>dbenv</strong></span> parameters to |
| 408 | <code class="methodname">Db::open()</code> are |
| 409 | <code class="literal">NULL</code>, the environment variable |
| 410 | <span class="bold"><strong>TMPDIR</strong></span> may be used as |
| 411 | a directory in which to create temporary backing files |
| 412 | </p> |
| 413 | </li> |
| 414 | </ul> |
| 415 | </div> |
| 416 | </div> |
| 417 | <div class="sect2" lang="en" xml:lang="en"> |
| 418 | <div class="titlepage"> |
| 419 | <div> |
| 420 | <div> |
| 421 | <h3 class="title"><a id="idm2019096"></a>Errors</h3> |
| 422 | </div> |
| 423 | </div> |
| 424 | </div> |
| 425 | <p> |
| 426 | The <code class="methodname">Db::open()</code> <span> |
| 427 | |
| 428 | <span> |
| 429 | method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> |
| 430 | exception, encapsulating one of the following non-zero errors, or return one |
| 431 | of the following non-zero errors: |
| 432 | </span> |
| 433 | </span> |
| 434 | </p> |
| 435 | <div class="sect3" lang="en" xml:lang="en"> |
| 436 | <div class="titlepage"> |
| 437 | <div> |
| 438 | <div> |
| 439 | <h4 class="title"><a id="idm1967984"></a><span>DbDeadlockException or </span>DB_LOCK_DEADLOCK</h4> |
| 440 | </div> |
| 441 | </div> |
| 442 | </div> |
| 443 | <p> |
| 444 | A transactional database environment operation was selected to resolve |
| 445 | a deadlock. |
| 446 | </p> |
| 447 | <p> |
| 448 | <a class="xref" href="dbdeadlock.html" title="DbDeadlockException">DbDeadlockException</a> is thrown if |
| 449 | your Berkeley DB API is configured to throw exceptions. |
| 450 | Otherwise, <code class="literal">DB_LOCK_DEADLOCK</code> is returned. |
| 451 | </p> |
| 452 | </div> |
| 453 | <div class="sect3" lang="en" xml:lang="en"> |
| 454 | <div class="titlepage"> |
| 455 | <div> |
| 456 | <div> |
| 457 | <h4 class="title"><a id="idm1054840"></a><span>DbLockNotGrantedException or </span>DB_LOCK_NOTGRANTED</h4> |
| 458 | </div> |
| 459 | </div> |
| 460 | </div> |
| 461 | <p> |
| 462 | A Berkeley DB Concurrent Data Store database environment configured |
| 463 | for lock timeouts was unable to grant a lock in the allowed time. |
| 464 | </p> |
| 465 | <p> |
| 466 | You attempted to open a database handle that is configured |
| 467 | for no waiting exclusive locking, but the exclusive lock could not be |
| 468 | immediately obtained. See |
| 469 | <a class="xref" href="dbset_lk_exclusive.html" title="Db::set_lk_exclusive()">Db::set_lk_exclusive()</a> |
| 470 | for more information. |
| 471 | </p> |
| 472 | <p> |
| 473 | <a class="xref" href="dblocknotgranted.html" title="DbLockNotGrantedException">DbLockNotGrantedException</a> is thrown if |
| 474 | your Berkeley DB API is configured to throw exceptions. |
| 475 | Otherwise, <code class="literal">DB_LOCK_NOTGRANTED</code> is returned. |
| 476 | </p> |
| 477 | </div> |
| 478 | <div class="sect3" lang="en" xml:lang="en"> |
| 479 | <div class="titlepage"> |
| 480 | <div> |
| 481 | <div> |
| 482 | <h4 class="title"><a id="idp314752"></a>ENOENT</h4> |
| 483 | </div> |
| 484 | </div> |
| 485 | </div> |
| 486 | <p> |
| 487 | The file or directory does not exist. |
| 488 | </p> |
| 489 | </div> |
| 490 | <div class="sect3" lang="en" xml:lang="en"> |
| 491 | <div class="titlepage"> |
| 492 | <div> |
| 493 | <div> |
| 494 | <h4 class="title"><a id="idp81120"></a>ENOENT</h4> |
| 495 | </div> |
| 496 | </div> |
| 497 | </div> |
| 498 | <p> |
| 499 | A nonexistent <span class="bold"><strong>re_source</strong></span> file was specified. |
| 500 | </p> |
| 501 | </div> |
| 502 | <div class="sect3" lang="en" xml:lang="en"> |
| 503 | <div class="titlepage"> |
| 504 | <div> |
| 505 | <div> |
| 506 | <h4 class="title"><a id="idp3077928"></a>DB_OLD_VERSION</h4> |
| 507 | </div> |
| 508 | </div> |
| 509 | </div> |
| 510 | <p> |
| 511 | The database cannot be opened without being first upgraded. |
| 512 | </p> |
| 513 | </div> |
| 514 | <div class="sect3" lang="en" xml:lang="en"> |
| 515 | <div class="titlepage"> |
| 516 | <div> |
| 517 | <div> |
| 518 | <h4 class="title"><a id="idp4049768"></a>EEXIST</h4> |
| 519 | </div> |
| 520 | </div> |
| 521 | </div> |
| 522 | <p> |
| 523 | <code class="literal">DB_CREATE</code> and <code class="literal">DB_EXCL</code> |
| 524 | were specified and the database exists. |
| 525 | </p> |
| 526 | </div> |
| 527 | <div class="sect3" lang="en" xml:lang="en"> |
| 528 | <div class="titlepage"> |
| 529 | <div> |
| 530 | <div> |
| 531 | <h4 class="title"><a id="idm474240"></a>EINVAL</h4> |
| 532 | </div> |
| 533 | </div> |
| 534 | </div> |
| 535 | <p> |
| 536 | If an unknown database type, page size, hash function, pad |
| 537 | byte, byte order, or a flag value or parameter that is |
| 538 | incompatible with the specified database was specified; the |
| 539 | <a class="link" href="envopen.html#envopen_DB_THREAD">DB_THREAD</a> |
| 540 | flag was specified and fast mutexes are not available for |
| 541 | this architecture; the |
| 542 | <a class="link" href="envopen.html#envopen_DB_THREAD">DB_THREAD</a> |
| 543 | flag was specified to <code class="methodname">Db::open()</code>, |
| 544 | but was not specified to the |
| 545 | <code class="methodname">DbEnv::open()</code> call for the |
| 546 | environment in which the |
| 547 | <a class="link" href="db.html" title="Chapter 2. The Db Handle">Db</a> handle was created; a |
| 548 | backing flat text file was specified with either the |
| 549 | <a class="link" href="envopen.html#envopen_DB_THREAD">DB_THREAD</a> |
| 550 | flag or the provided database environment supports |
| 551 | transaction processing; a Heap database is in use and |
| 552 | <a class="xref" href="dbset_heapsize.html" title="Db::set_heapsize()">Db::set_heapsize()</a> |
| 553 | was used to set a heap size that is different from the value |
| 554 | used to create the database or an invalid heap region size was |
| 555 | set using <a class="xref" href="dbset_heap_regionsize.html" title="Db::set_heap_regionsize()">Db::set_heap_regionsize()</a>; |
| 556 | or if an invalid flag value or parameter was specified. |
| 557 | </p> |
| 558 | </div> |
| 559 | <div class="sect3" lang="en" xml:lang="en"> |
| 560 | <div class="titlepage"> |
| 561 | <div> |
| 562 | <div> |
| 563 | <h4 class="title"><a id="idp4086264"></a> <span>DbRepHandleDeadException or</span> DB_REP_HANDLE_DEAD</h4> |
| 564 | </div> |
| 565 | </div> |
| 566 | </div> |
| 567 | <p> |
| 568 | When a client synchronizes with the master, it is possible for committed |
| 569 | transactions to be rolled back. This invalidates all the database and cursor |
| 570 | handles opened in the replication environment. Once this occurs, an attempt to use |
| 571 | such a handle will |
| 572 | <span> |
| 573 | throw a <a class="xref" href="dbrephandledead.html" title="DbRepHandleDeadException">DbRepHandleDeadException</a> (if |
| 574 | your application is configured to throw exceptions), or |
| 575 | </span> |
| 576 | return <code class="literal">DB_REP_HANDLE_DEAD</code>. |
| 577 | The application will need to discard the handle and open a new one in order to |
| 578 | continue processing. |
| 579 | </p> |
| 580 | </div> |
| 581 | <div class="sect3" lang="en" xml:lang="en"> |
| 582 | <div class="titlepage"> |
| 583 | <div> |
| 584 | <div> |
| 585 | <h4 class="title"><a id="idm791264"></a><span>DbDeadlockException or </span>DB_REP_LOCKOUT</h4> |
| 586 | </div> |
| 587 | </div> |
| 588 | </div> |
| 589 | <p> |
| 590 | The operation was blocked by client/master synchronization. |
| 591 | </p> |
| 592 | <p> |
| 593 | <a class="xref" href="dbdeadlock.html" title="DbDeadlockException">DbDeadlockException</a> is thrown if |
| 594 | your Berkeley DB API is configured to throw exceptions. |
| 595 | Otherwise, <code class="literal">DB_REP_LOCKOUT</code> is returned. |
| 596 | </p> |
| 597 | </div> |
| 598 | </div> |
| 599 | <div class="sect2" lang="en" xml:lang="en"> |
| 600 | <div class="titlepage"> |
| 601 | <div> |
| 602 | <div> |
| 603 | <h3 class="title"><a id="idm1622592"></a>Class</h3> |
| 604 | </div> |
| 605 | </div> |
| 606 | </div> |
| 607 | <p> |
| 608 | <a class="link" href="db.html" title="Chapter 2. The Db Handle">Db</a> |
| 609 | </p> |
| 610 | </div> |
| 611 | <div class="sect2" lang="en" xml:lang="en"> |
| 612 | <div class="titlepage"> |
| 613 | <div> |
| 614 | <div> |
| 615 | <h3 class="title"><a id="idm1301808"></a>See Also</h3> |
| 616 | </div> |
| 617 | </div> |
| 618 | </div> |
| 619 | <p> |
| 620 | <a class="xref" href="db.html#dblist" title="Database and Related Methods">Database and Related Methods</a> |
| 621 | </p> |
| 622 | </div> |
| 623 | </div> |
| 624 | <div class="navfooter"> |
| 625 | <hr /> |
| 626 | <table width="100%" summary="Navigation footer"> |
| 627 | <tr> |
| 628 | <td width="40%" align="left"><a accesskey="p" href="dbkey_range.html">Prev</a> </td> |
| 629 | <td width="20%" align="center"> |
| 630 | <a accesskey="u" href="db.html">Up</a> |
| 631 | </td> |
| 632 | <td width="40%" align="right"> <a accesskey="n" href="dbput.html">Next</a></td> |
| 633 | </tr> |
| 634 | <tr> |
| 635 | <td width="40%" align="left" valign="top">Db::key_range() </td> |
| 636 | <td width="20%" align="center"> |
| 637 | <a accesskey="h" href="index.html">Home</a> |
| 638 | </td> |
| 639 | <td width="40%" align="right" valign="top"> Db::put()</td> |
| 640 | </tr> |
| 641 | </table> |
| 642 | </div> |
| 643 | </body> |
| 644 | </html> |