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