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>Environments</title> 7 <link rel="stylesheet" href="gettingStarted.css" type="text/css" /> 8 <meta name="generator" content="DocBook XSL Stylesheets V1.62.4" /> 9 <link rel="home" href="index.html" title="Getting Started with Berkeley DB" /> 10 <link rel="up" href="introduction.html" title="Chapter��1.��Introduction to Berkeley DB " /> 11 <link rel="previous" href="databaseLimits.html" title="Database Limits and Portability" /> 12 <link rel="next" href="returns.html" title="Error Returns" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">Environments</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="databaseLimits.html">Prev</a>��</td> 22 <th width="60%" align="center">Chapter��1.��Introduction to Berkeley DB </th> 23 <td width="20%" align="right">��<a accesskey="n" href="returns.html">Next</a></td> 24 </tr> 25 </table> 26 <hr /> 27 </div> 28 <div class="sect1" lang="en" xml:lang="en"> 29 <div class="titlepage"> 30 <div> 31 <div> 32 <h2 class="title" style="clear: both"><a id="environments"></a>Environments</h2> 33 </div> 34 </div> 35 <div></div> 36 </div> 37 <p> 38 This manual is meant as an introduction to the Berkeley DB library. 39 Consequently, it describes how to build a very simple, single-threaded 40 application and so this manual omits a great many powerful 41 aspects of the DB database engine that are not required by simple 42 applications. One of these is important enough that it warrants a brief 43 overview here: environments. 44 </p> 45 <p> 46 While environments are frequently not used by applications running in 47 embedded environments where every byte counts, they will be used by 48 virtually any other DB application requiring anything other than 49 the bare minimum functionality. 50 </p> 51 <span> 52 <p> 53 An <span class="emphasis"><em>environment</em></span> is 54 essentially an encapsulation of one or more databases. You 55 open an environment and then you open databases in that environment. 56 When you do so, the databases are created/located in a location relative 57 to the environment's home directory. 58 </p> 59 <p> 60 Environments offer a great many features that a stand-alone DB 61 database cannot offer: 62 </p> 63 <div class="itemizedlist"><ul type="disc"><li><p> 64 Multi-database files. 65 </p><p> 66 It is possible in DB to contain multiple databases in a 67 single physical file on disk. This is desirable for those 68 application that open more than a few handful of databases. 69 However, in order to have more than one database contained in 70 a single physical file, your application 71 <span class="emphasis"><em>must</em></span> use an environment. 72 </p></li><li><p> 73 Multi-thread and multi-process support 74 </p><p> 75 When you use an environment, resources such as the in-memory 76 cache and locks can be shared by all of the databases opened in the 77 environment. The environment allows you to enable 78 subsystems that are designed to allow multiple threads and/or 79 processes to access DB databases. For example, you use an 80 environment to enable the concurrent data store (CDS), the 81 locking subsystem, and/or the shared memory buffer pool. 82 </p></li><li><p> 83 Transactional processing 84 </p><p> 85 DB offers a transactional subsystem that allows for full 86 ACID-protection of your database writes. You use environments to 87 enable the transactional subsystem, and then subsequently to obtain 88 transaction IDs. 89 </p></li><li><p> 90 High availability (replication) support 91 </p><p> 92 DB offers a replication subsystem that enables 93 single-master database replication with multiple read-only 94 copies of the replicated data. You use environments to enable 95 and then manage this subsystem. 96 </p></li><li><p> 97 Logging subsystem 98 </p><p> 99 DB offers write-ahead logging for applications that want to 100 obtain a high-degree of recoverability in the face of an 101 application or system crash. Once enabled, the logging subsystem 102 allows the application to perform two kinds of recovery 103 ("normal" and "catastrophic") through the use of the information 104 contained in the log files. 105 </p></li></ul></div> 106 <p> 107 For more information on these topics, see the 108 <i class="citetitle">Berkeley DB Getting Started with Transaction Processing</i> guide and the 109 <i class="citetitle">Berkeley DB Getting Started with Replicated Applications</i> guide. 110 </p> 111</span> 112 </div> 113 <div class="navfooter"> 114 <hr /> 115 <table width="100%" summary="Navigation footer"> 116 <tr> 117 <td width="40%" align="left"><a accesskey="p" href="databaseLimits.html">Prev</a>��</td> 118 <td width="20%" align="center"> 119 <a accesskey="u" href="introduction.html">Up</a> 120 </td> 121 <td width="40%" align="right">��<a accesskey="n" href="returns.html">Next</a></td> 122 </tr> 123 <tr> 124 <td width="40%" align="left" valign="top">Database Limits and Portability��</td> 125 <td width="20%" align="center"> 126 <a accesskey="h" href="index.html">Home</a> 127 </td> 128 <td width="40%" align="right" valign="top">��Error Returns</td> 129 </tr> 130 </table> 131 </div> 132 </body> 133</html> 134