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="coreExceptions.html" title="Exception Handling" /> 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="coreExceptions.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. Consequently, 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. An <span class="emphasis"><em>environment</em></span> is 50 essentially an encapsulation of one or more databases. Essentially, you 51 open an environment and then you open databases in that environment. 52 When you do so, the databases are created/located in a location relative 53 to the environment's home directory. 54 </p> 55 <p> 56 Environments offer a great many features that a stand-alone DB 57 database cannot offer: 58 </p> 59 <div class="itemizedlist"> 60 <ul type="disc"> 61 <li> 62 <p> 63 Multi-database files. 64 </p> 65 <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> 73 </li> 74 <li> 75 <p> 76 Multi-thread and multi-process support 77 </p> 78 <p> 79 When you use an environment, resources such as the in-memory 80 cache and locks can be shared by all of the databases opened in the 81 environment. The environment allows you to enable 82 subsystems that are designed to allow multiple threads and/or 83 processes to access DB databases. For example, you use an 84 environment to enable the concurrent data store (CDS), the 85 locking subsystem, and/or the shared memory buffer pool. 86 </p> 87 </li> 88 <li> 89 <p> 90 Transactional processing 91 </p> 92 <p> 93 DB offers a transactional subsystem that allows for full 94 ACID-protection of your database writes. You use environments to 95 enable the transactional subsystem, and then subsequently to obtain 96 transaction IDs. 97 </p> 98 </li> 99 <li> 100 <p> 101 High availability (replication) support 102 </p> 103 <p> 104 DB offers a replication subsystem that enables 105 single-master database replication with multiple read-only 106 copies of the replicated data. You use environments to enable 107 and then manage this subsystem. 108 </p> 109 </li> 110 <li> 111 <p> 112 Logging subsystem 113 </p> 114 <p> 115 DB offers write-ahead logging for applications that want to 116 obtain a high-degree of recoverability in the face of an 117 application or system crash. Once enabled, the logging subsystem 118 allows the application to perform two kinds of recovery 119 ("normal" and "catastrophic") through the use of the information 120 contained in the log files. 121 </p> 122 </li> 123 </ul> 124 </div> 125 <p> 126 For more information on these topics, see the 127 <i class="citetitle">Berkeley DB Getting Started with Transaction Processing</i> guide and the 128 <i class="citetitle">Berkeley DB Getting Started with Replicated Applications</i> guide. 129 </p> 130 </div> 131 <div class="navfooter"> 132 <hr /> 133 <table width="100%" summary="Navigation footer"> 134 <tr> 135 <td width="40%" align="left"><a accesskey="p" href="databaseLimits.html">Prev</a>��</td> 136 <td width="20%" align="center"> 137 <a accesskey="u" href="introduction.html">Up</a> 138 </td> 139 <td width="40%" align="right">��<a accesskey="n" href="coreExceptions.html">Next</a></td> 140 </tr> 141 <tr> 142 <td width="40%" align="left" valign="top">Database Limits and Portability��</td> 143 <td width="20%" align="center"> 144 <a accesskey="h" href="index.html">Home</a> 145 </td> 146 <td width="40%" align="right" valign="top">��Exception Handling</td> 147 </tr> 148 </table> 149 </div> 150 </body> 151</html> 152