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>berkdb 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 TCL API Reference" /> 10 <link rel="up" href="tclapi.html" title="Chapter 1. Berkeley DB Tcl APIs" /> 11 <link rel="prev" href="db_join.html" title="db join" /> 12 <link rel="next" href="db_put.html" title="db put" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">berkdb open</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="db_join.html">Prev</a> </td> 22 <th width="60%" align="center">Chapter 1. 23 Berkeley DB Tcl APIs 24 </th> 25 <td width="20%" align="right"> <a accesskey="n" href="db_put.html">Next</a></td> 26 </tr> 27 </table> 28 <hr /> 29 </div> 30 <div class="sect1" lang="en" xml:lang="en"> 31 <div class="titlepage"> 32 <div> 33 <div> 34 <h2 class="title" style="clear: both"><a id="db_open"></a>berkdb open</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">berkdb open 39 [-auto_commit] 40 [-btree | -hash | -recno | -queue | -unknown] 41 [-cachesize {gbytes bytes ncache}] 42 [-create] 43 [-delim delim] 44 [-dup] 45 [-dupsort] 46 [-encrypt] 47 [-encryptaes passwd] 48 [-encryptany passwd] 49 [-env env] 50 [-errfile filename] 51 [-excl] 52 [-extent size] 53 [-ffactor density] 54 [-len len] 55 [-mode mode] 56 [-nelem size] 57 [-pad pad] 58 [-pagesize pagesize] 59 [-rdonly] 60 [-recnum] 61 [-renumber] 62 [-snapshot] 63 [-source file] 64 [-truncate] 65 [-txn txnid] 66 [--] 67 [file [database]] </pre> 68 <p> 69 The <span class="bold"><strong>berkdb open</strong></span> command opens and 70 optionally creates a database. The returned database handle is bound 71 to a Tcl command of the form <span class="bold"><strong>dbN</strong></span>, 72 where N is an integer starting at 0 (for example, db0 and db1). It is 73 through this Tcl command that the script accesses the database 74 methods. 75 </p> 76 <p> 77 The options are as follows: 78 </p> 79 <div class="itemizedlist"> 80 <ul type="disc"> 81 <li> 82 <p> 83 <span class="bold"><strong>-auto_commit</strong></span> 84 </p> 85 <p> 86 Enclose the call within an implicit transaction (you do not need to provide a transaction handle 87 as a transaction is internally created and commited for you). If the call succeeds, the open 88 operation will be recoverable and all subsequent database modification 89 operations based on this handle will be transactionally protected. If 90 the call fails, no database will have been created. 91 </p> 92 </li> 93 <li> 94 <p> 95 <span class="bold"><strong>-btree</strong></span> 96 </p> 97 <p> 98 Open/create a database of type Btree. The Btree format is a 99 representation of a sorted, balanced tree structure. 100 </p> 101 </li> 102 <li> 103 <p> 104 <span class="bold"><strong>-hash</strong></span> 105 </p> 106 <p> 107 Open/create a database of type Hash. The Hash format is an 108 extensible, dynamic hashing scheme. 109 </p> 110 </li> 111 <li> 112 <p> 113 <span class="bold"><strong>-queue</strong></span> 114 </p> 115 <p> 116 Open/create a database of type Queue. The Queue format supports fast 117 access to fixed-length records accessed by sequentially or logical 118 record number. 119 </p> 120 </li> 121 <li> 122 <p> 123 <span class="bold"><strong>-recno</strong></span> 124 </p> 125 <p> 126 Open/create a database of type Recno. The Recno format supports 127 fixed- or variable-length records, accessed sequentially or by logical 128 record number, and optionally retrieved from a flat text file. 129 </p> 130 </li> 131 <li> 132 <p> 133 <span class="bold"><strong>-unknown</strong></span> 134 </p> 135 <p> 136 The database is of an unknown type, and must already exist. 137 </p> 138 </li> 139 <li> 140 <p> 141 <span class="bold"><strong>-cachesize {gbytes bytes ncache}</strong></span> 142 </p> 143 <p> 144 Set the size of the database's shared memory buffer pool (that is, the 145 cache), to <span class="bold"><strong>gbytes</strong></span> gigabytes plus 146 <span class="bold"><strong>bytes</strong></span>. The cache should be the size 147 of the normal working data set of the application, with some small 148 amount of additional memory for unusual situations. (Note: The working 149 set is not the same as the number of simultaneously referenced pages, 150 and should be quite a bit larger!) 151 </p> 152 <p> 153 The default cache size is 256KB, and may not be specified as less than 154 20KB. Any cache size less than 500MB is automatically increased by 155 25% to account for buffer pool overhead; cache sizes larger than 500MB 156 are used as specified. 157 </p> 158 <p> 159 It is possible to specify caches to Berkeley DB that are large enough 160 so that they cannot be allocated contiguously on some architectures; 161 for example, some releases of Solaris limit the amount of memory that 162 may be allocated contiguously by a process. If <span class="bold"><strong>ncache</strong></span> is 0 or 1, the cache will be allocated 163 contiguously in memory. If it is greater than 1, the cache will be 164 broken up into <span class="bold"><strong>ncache</strong></span> equally sized 165 separate pieces of memory. 166 </p> 167 <p> 168 For information on tuning the Berkeley DB cache size, see 169 <a href="../../programmer_reference/general_am_conf.html#am_conf_cachesize" class="olink">Selecting a Cache Size</a> 170 in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em>. 171 </p> 172 <p> 173 Because databases opened within Berkeley DB environments use the cache 174 specified to the environment, it is an error to attempt to set a cache 175 in a database created within an environment. 176 </p> 177 </li> 178 <li> 179 <p> 180 <span class="bold"><strong>-create</strong></span> 181 </p> 182 <p> 183 Create any underlying files, as necessary. If the files do not already 184 exist and the <span class="bold"><strong>-create</strong></span> argument is not 185 specified, the call will fail. 186 </p> 187 </li> 188 <li> 189 <p> 190 <span class="bold"><strong>-delim delim</strong></span> 191 </p> 192 <p> 193 Set the delimiting byte used to mark the end of a record in the 194 backing source file for the Recno access method. 195 </p> 196 <p> 197 This byte is used for variable length records if the <span class="bold"><strong>-source</strong></span> argument file is specified. If the 198 <span class="bold"><strong>-source</strong></span> argument file is specified 199 and no delimiting byte was specified, <newline> characters (that 200 is, ASCII 0x0a) are interpreted as end-of-record markers. 201 </p> 202 </li> 203 <li> 204 <p> 205 <span class="bold"><strong>-dup</strong></span> 206 </p> 207 <p> 208 Permit duplicate data items in the tree, that is, insertion when the 209 key of the key/data pair being inserted already exists in the tree 210 will be successful. The ordering of duplicates in the tree is 211 determined by the order of insertion unless the ordering is otherwise 212 specified by use of a cursor or a duplicate comparison function. 213 </p> 214 <p> 215 It is an error to specify both <span class="bold"><strong>-dup</strong></span> and 216 <span class="bold"><strong>-recnum</strong></span>. 217 </p> 218 </li> 219 <li> 220 <p> 221 <span class="bold"><strong>-dupsort</strong></span> 222 </p> 223 <p> 224 Sort duplicates within a set of data items. A default lexical 225 comparison will be used. Specifying that duplicates are to be sorted 226 changes the behavior of the <span class="emphasis"><em>db</em></span> <span class="bold"><strong>put</strong></span> operation as well as the 227 <span class="emphasis"><em>dbc</em></span> <span class="bold"><strong>put</strong></span> 228 operation when the <span class="bold"><strong>-keyfirst</strong></span>, 229 <span class="bold"><strong>-keylast</strong></span> and <span class="bold"><strong>-current</strong></span> options are specified. 230 </p> 231 </li> 232 <li> 233 <p> 234 <span class="bold"><strong>-encrypt</strong></span> 235 </p> 236 <p> 237 Specify the database in an environment should be encrypted with the 238 same password that is being used in the environment. 239 </p> 240 </li> 241 <li> 242 <p> 243 <span class="bold"><strong>-encryptaes passwd</strong></span> 244 </p> 245 <p> 246 Specify the database should be encrypted with the given password using 247 the Rijndael/AES (also known as the Advanced Encryption Standard and 248 Federal Information Processing Standard (FIPS) 197) algorithm. 249 </p> 250 </li> 251 <li> 252 <p> 253 <span class="bold"><strong>-encryptany passwd</strong></span> 254 </p> 255 <p> 256 Specify the already existing database should be opened with the given 257 password. This option is used if the database is known to be 258 encrypted, but the specific algorithm used is not known. 259 </p> 260 </li> 261 <li> 262 <p> 263 <span class="bold"><strong>-env env</strong></span> 264 </p> 265 <p> 266 If no <span class="bold"><strong>-env</strong></span> argument is given, the 267 database is standalone; that is, it is not part of any Berkeley DB 268 environment. 269 </p> 270 <p> 271 If a <span class="bold"><strong>-env</strong></span> argument is given, the 272 database is created within the specified Berkeley DB environment. The 273 database access methods automatically make calls to the other 274 subsystems in Berkeley DB, based on the enclosing environment. For 275 example, if the environment has been configured to use locking, the 276 access methods will automatically acquire the correct locks when 277 reading and writing pages of the database. 278 </p> 279 </li> 280 <li> 281 <p> 282 <span class="bold"><strong>-errfile filename</strong></span> 283 </p> 284 <p> 285 When an error occurs in the Berkeley DB library, a Berkeley DB error 286 or an error return value is returned by the function. In some cases, 287 however, the errno value may be insufficient to completely describe 288 the cause of the error especially during initial application 289 debugging. 290 </p> 291 <p> 292 The <span class="bold"><strong>-errfile</strong></span> argument is used to 293 enhance the mechanism for reporting error messages to the application 294 by specifying a file to be used for displaying additional Berkeley DB 295 error messages. In some cases, when an error occurs, Berkeley DB will 296 output an additional error message to the specified file reference. 297 </p> 298 <p> 299 The error message will consist of a Tcl command name and a colon 300 (":"), an error string, and a trailing <newline> character. If 301 the database was opened in an environment, the Tcl command name will 302 be the environment name (for example, env0), otherwise it will be the 303 database command name (for example, db0). 304 </p> 305 <p> 306 This error-logging enhancement does not slow performance or 307 significantly increase application size, and may be run during normal 308 operation as well as during application debugging. 309 </p> 310 <p> 311 For database handles opened inside of Berkeley DB environments, 312 specifying the <span class="bold"><strong>-errfile</strong></span> argument 313 affects the entire environment and is equivalent to specifying the 314 same argument to the <span class="bold"><strong>berkdb env</strong></span> 315 command. 316 </p> 317 </li> 318 <li> 319 <p> 320 <span class="bold"><strong>-excl</strong></span> 321 </p> 322 <p> 323 Return an error if the database already exists. 324 </p> 325 </li> 326 <li> 327 <p> 328 <span class="bold"><strong>-extent size</strong></span> 329 </p> 330 <p> 331 Set the size of the extents of the Queue database; the size is 332 specified as the number of pages in an extent. Each extent is created 333 as a separate physical file. If no extent size is set, the default 334 behavior is to create only a single underlying database file. 335 </p> 336 <p> 337 For information on tuning the extent size, see 338 <a href="../../programmer_reference/rq_conf.html#am_conf_extentsize" class="olink">Selecting an Extent Size</a> 339 in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em>. 340 </p> 341 </li> 342 <li> 343 <p> 344 <span class="bold"><strong>-ffactor density</strong></span> 345 </p> 346 <p> 347 Set the desired density within the hash table. 348 </p> 349 <p> 350 The density is an approximation of the number of keys allowed to 351 accumulate in any one bucket 352 </p> 353 </li> 354 <li> 355 <p> 356 <span class="bold"><strong>-len len</strong></span> 357 </p> 358 <p> 359 For the Queue access method, specify that the records are of length 360 <span class="bold"><strong>len</strong></span>. 361 </p> 362 <p> 363 For the Recno access method, specify that the records are 364 fixed-length, not byte-delimited, and are of length <span class="bold"><strong>len</strong></span>. 365 </p> 366 <p> 367 Any records added to the database that are less than <span class="bold"><strong>len</strong></span> bytes long are automatically padded (see 368 the <span class="bold"><strong>-pad</strong></span> argument for more 369 information). 370 </p> 371 <p> 372 Any attempt to insert records into the database that are greater than 373 <span class="bold"><strong>len</strong></span> bytes long will cause the call to 374 fail immediately and return an error. 375 </p> 376 </li> 377 <li> 378 <p> 379 <span class="bold"><strong>-mode mode</strong></span> 380 </p> 381 <p> 382 On UNIX systems, or in IEEE/ANSI Std 1003.1 (POSIX) environments, all 383 files created by the access methods 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 384 value at the time of creation (see <span class="bold"><strong>umask</strong></span>(2)). The group ownership of created 385 files is based on the system and directory defaults, and is not 386 further specified by Berkeley DB. If <span class="bold"><strong>mode</strong></span> is 0, files are created readable and 387 writable by both owner and group. On Windows systems, the mode 388 argument is ignored. 389 </p> 390 </li> 391 <li> 392 <p> 393 <span class="bold"><strong>-nelem size</strong></span> 394 </p> 395 <p> 396 Set an estimate of the final size of the hash table. 397 </p> 398 <p> 399 If not set or set too low, hash tables will still expand gracefully as 400 keys are entered, although a slight performance degradation may be 401 noticed. 402 </p> 403 </li> 404 <li> 405 <p> 406 <span class="bold"><strong>-pad pad</strong></span> 407 </p> 408 <p> 409 Set the padding character for short, fixed-length records for the 410 Queue and Recno access methods. 411 </p> 412 <p> 413 If no pad character is specified, <space> characters (that is, 414 ASCII 0x20) are used for padding. 415 </p> 416 </li> 417 <li> 418 <p> 419 <span class="bold"><strong>-pagesize pagesize</strong></span> 420 </p> 421 <p> 422 Set the size of the pages used to hold items in the database, in 423 bytes. The minimum page size is 512 bytes, and the maximum page size 424 is 64K bytes. If the page size is not explicitly set, one is selected 425 based on the underlying filesystem I/O block size. The automatically 426 selected size has a lower limit of 512 bytes and an upper limit of 16K 427 bytes. 428 </p> 429 <p> 430 For information on tuning the Berkeley DB page size, see 431 <a href="../../programmer_reference/general_am_conf.html#am_conf_pagesize" class="olink">Selecting a Page Size</a> 432 in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em>. 433 </p> 434 </li> 435 <li> 436 <p> 437 <span class="bold"><strong>-rdonly</strong></span> 438 </p> 439 <p> 440 Open the database for reading only. Any attempt to modify items in the 441 database will fail, regardless of the actual permissions of any 442 underlying files. 443 </p> 444 </li> 445 <li> 446 <p> 447 <span class="bold"><strong>-recnum</strong></span> 448 </p> 449 <p> 450 Support retrieval from the Btree using record numbers. 451 </p> 452 <p> 453 Logical record numbers in Btree databases are mutable in the face of 454 record insertion or deletion. See the <span class="bold"><strong>-renumber</strong></span> argument for further discussion. 455 </p> 456 <p> 457 Maintaining record counts within a Btree introduces a serious point of 458 contention, namely the page locations where the record counts are 459 stored. In addition, the entire tree must be locked during both 460 insertions and deletions, effectively single-threading the tree for 461 those operations. Specifying <span class="bold"><strong>-recnum</strong></span> 462 can result in serious performance degradation for some applications 463 and data sets. 464 </p> 465 <p> 466 It is an error to specify both <span class="bold"><strong>-dup</strong></span> 467 and <span class="bold"><strong>-recnum</strong></span>. 468 </p> 469 </li> 470 <li> 471 <p> 472 <span class="bold"><strong>-renumber</strong></span> 473 </p> 474 <p> 475 Specifying the <span class="bold"><strong>-renumber</strong></span> argument 476 causes the logical record numbers to be mutable, and change as records 477 are added to and deleted from the database. For example, the deletion 478 of record number 4 causes records numbered 5 and greater to be 479 renumbered downward by one. If a cursor was positioned to record 480 number 4 before the deletion, it will refer to the new record number 481 4, if any such record exists, after the deletion. If a cursor was 482 positioned after record number 4 before the deletion, it will be 483 shifted downward one logical record, continuing to refer to the same 484 record as it did before. 485 </p> 486 <p> 487 Using the <span class="emphasis"><em>db</em></span> <span class="bold"><strong>put</strong></span> 488 or <span class="emphasis"><em>dbc</em></span> <span class="bold"><strong>put</strong></span> 489 interfaces to create new records will cause the creation of multiple 490 records if the record number is more than one greater than the largest 491 record currently in the database. For example, creating record 28 when 492 record 25 was previously the last record in the database, will create 493 records 26 and 27 as well as 28. 494 </p> 495 <p> 496 If a created record is not at the end of the database, all records 497 following the new record will be automatically renumbered upward by 498 one. For example, the creation of a new record numbered 8 causes 499 records numbered 8 and greater to be renumbered upward by one. If a 500 cursor was positioned to record number 8 or greater before the 501 insertion, it will be shifted upward one logical record, continuing to 502 refer to the same record as it did before. 503 </p> 504 <p> 505 For these reasons, concurrent access to a Recno database with the 506 <span class="bold"><strong>-renumber</strong></span> flag specified may be 507 largely meaningless, although it is supported. 508 </p> 509 </li> 510 <li> 511 <p> 512 <span class="bold"><strong>-snapshot</strong></span> 513 </p> 514 <p> 515 This argument specifies that any specified <span class="bold"><strong>-source</strong></span> file be read in its entirety when the 516 database is opened. If this argument is not specified, the <span class="bold"><strong>-source</strong></span> file may be read lazily. 517 </p> 518 </li> 519 <li> 520 <p> 521 <span class="bold"><strong>-source file</strong></span> 522 </p> 523 <p> 524 Set the underlying source file for the Recno access method. The 525 purpose of the <span class="bold"><strong>-source</strong></span> file is to 526 provide fast access and modification to databases that are normally 527 stored as flat text files. 528 </p> 529 <p> 530 If the <span class="bold"><strong>-source</strong></span> argument is give, it 531 specifies an underlying flat text database file that is read to 532 initialize a transient record number index. In the case of variable 533 length records, the records are separated as specified by <span class="bold"><strong>-delim</strong></span>. For example, standard UNIX byte stream 534 files can be interpreted as a sequence of variable length records 535 separated by <newline> characters. 536 </p> 537 <p> 538 In addition, when cached data would normally be written back to the 539 underlying database file (for example, when the 540 <span class="emphasis"><em>db</em></span> <span class="bold"><strong>close</strong></span> or 541 <span class="emphasis"><em>db</em></span> <span class="bold"><strong>sync</strong></span> commands 542 are called), the in-memory copy of the database will be written back 543 to the <span class="bold"><strong>-source</strong></span> file. 544 </p> 545 <p> 546 By default, the backing source file is read lazily, that is, records 547 are not read from the file until they are requested by the 548 application. <span class="bold"><strong>If multiple processes (not threads) 549 are accessing a Recno database concurrently and either inserting or 550 deleting records, the backing source file must be read in its entirety 551 before more than a single process accesses the database, and only that 552 process should specify the backing source argument as part of the 553 <span class="bold"><strong>berkdb open</strong></span> call. See the <span class="bold"><strong>-snapshot</strong></span> argument for more 554 information.</strong></span> 555 </p> 556 <p> 557 <span class="bold"><strong>Reading and writing the backing source file 558 specified by <span class="bold"><strong>-source</strong></span> cannot be 559 transaction protected because it involves filesystem operations that 560 are not part of the Berkeley DB transaction methodology.</strong></span> 561 For this reason, if a temporary database is used to hold the records, 562 it is possible to lose the contents of the <span class="bold"><strong>-source</strong></span> file, for example, if the system crashes 563 at the right instant. If a file is used to hold the database, that 564 is, a filename was specified as the <span class="bold"><strong>file</strong></span> argument to <span class="bold"><strong>berkdb 565 open</strong></span>, normal database recovery on that file can be used to 566 prevent information loss, although it is still possible that the 567 contents of <span class="bold"><strong>-source</strong></span> file will be lost if 568 the system crashes. 569 </p> 570 <p> 571 The <span class="bold"><strong>-source</strong></span> file must already exist 572 (but may be zero-length) when <span class="bold"><strong>berkdb 573 open</strong></span> is called. 574 </p> 575 <p> 576 It is not an error to specify a read-only <span class="bold"><strong>-source</strong></span> file when creating a database, nor is 577 it an error to modify the resulting database. However, any attempt to 578 write the changes to the backing source file using either the 579 <span class="emphasis"><em>db</em></span> <span class="bold"><strong>close</strong></span> or 580 <span class="emphasis"><em>db</em></span> <span class="bold"><strong>sync</strong></span> commands 581 will fail, of course. Specifying the <span class="bold"><strong>-nosync</strong></span> argument to the <span class="emphasis"><em>db</em></span> 582 <span class="bold"><strong>close</strong></span> command will stop it from 583 attempting to write the changes to the backing file; instead, they 584 will be silently discarded. 585 </p> 586 <p> 587 For all of the previous reasons, the <span class="bold"><strong>-source</strong></span> file is generally used to specify 588 databases that are read-only for Berkeley DB applications, and that 589 are either generated on the fly by software tools, or modified using a 590 different mechanism such as a text editor. 591 </p> 592 </li> 593 <li> 594 <p> 595 <span class="bold"><strong>-truncate</strong></span> 596 </p> 597 <p> 598 Physically truncate the underlying file, discarding all previous 599 databases it might have held. Underlying filesystem primitives are 600 used to implement this flag. For this reason, it is only applicable 601 to the physical file and cannot be used to discard databases within a 602 file. 603 </p> 604 <p> 605 The <span class="bold"><strong>-truncate</strong></span> argument cannot be 606 transaction-protected, and it is an error to specify it in a 607 transaction-protected environment. 608 </p> 609 </li> 610 <li> 611 <p> 612 <span class="bold"><strong>-txn txnid</strong></span> 613 </p> 614 <p> 615 If the operation is part of an application-specified transaction, the 616 <span class="bold"><strong>txnid</strong></span> parameter is a transaction 617 handle returned from <span class="emphasis"><em>env</em></span> <span class="bold"><strong>txn</strong></span>. If no transaction handle is specified, 618 but the -auto_commit flag is specified, the operation will be 619 implicitly transaction protected. 620 </p> 621 </li> 622 <li> 623 <p> 624 <span class="bold"><strong>--</strong></span> 625 </p> 626 <p> 627 Mark the end of the command arguments. 628 </p> 629 </li> 630 <li> 631 <p> 632 <span class="bold"><strong>file</strong></span> 633 </p> 634 <p> 635 The name of a single physical file on disk that will be used to back 636 the database. 637 </p> 638 <p> 639 An in-memory database never intended to be preserved on 640 disk may be created by not specifying a file name. For 641 example: 642 </p> 643 <pre class="programlisting">berkdb open -create -btree </pre> 644 <p> 645 creates an in-memory database. 646 </p> 647 </li> 648 <li> 649 <p> 650 <span class="bold"><strong>database</strong></span> 651 </p> 652 <p> 653 The <span class="bold"><strong>database</strong></span> argument allows 654 applications to have multiple databases inside of a single physical 655 file. This is useful when the databases are both numerous and 656 reasonably small, in order to avoid creating a large number of 657 underlying files. It is an error to attempt to open a second database 658 file that was not initially created using a <span class="bold"><strong>database</strong></span> name. 659 </p> 660 <p> 661 Applications opening multiple databases in a single file will almost 662 certainly need to create a shared database environment. See 663 <a href="../../programmer_reference/am_opensub.html" class="olink">Opening multiple databases in a single file</a> 664 in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em> for more 665 information. 666 </p> 667 <p> 668 If more than one in-memory database is desired, it is 669 necessary to specify an empty string as the database name. 670 For example: 671 </p> 672 <pre class="programlisting">berkdb open -create -btree "" foo 673berkdb open -create -btree "" bar </pre> 674 <p> 675 will create two databases, neither of which will appear on 676 disk. 677 </p> 678 </li> 679 </ul> 680 </div> 681 <p> 682 The <span class="bold"><strong>berkdb open</strong></span> command returns a 683 database handle on success. 684 </p> 685 <p> 686 In the case of error, a Tcl error is thrown. 687 </p> 688 </div> 689 <div class="navfooter"> 690 <hr /> 691 <table width="100%" summary="Navigation footer"> 692 <tr> 693 <td width="40%" align="left"><a accesskey="p" href="db_join.html">Prev</a> </td> 694 <td width="20%" align="center"> 695 <a accesskey="u" href="tclapi.html">Up</a> 696 </td> 697 <td width="40%" align="right"> <a accesskey="n" href="db_put.html">Next</a></td> 698 </tr> 699 <tr> 700 <td width="40%" align="left" valign="top"><span class="emphasis"><em>db</em></span> join </td> 701 <td width="20%" align="center"> 702 <a accesskey="h" href="index.html">Home</a> 703 </td> 704 <td width="40%" align="right" valign="top"> <span class="emphasis"><em>db</em></span> put</td> 705 </tr> 706 </table> 707 </div> 708 </body> 709</html> 710