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>Chapter��1.��Introduction to Berkeley DB </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="index.html" title="Getting Started with Berkeley DB" /> 11 <link rel="previous" href="preface.html" title="Preface" /> 12 <link rel="next" href="javadplconcepts.html" title="Berkeley DB Concepts" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">Chapter��1.��Introduction to Berkeley DB </th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="preface.html">Prev</a>��</td> 22 <th width="60%" align="center">��</th> 23 <td width="20%" align="right">��<a accesskey="n" href="javadplconcepts.html">Next</a></td> 24 </tr> 25 </table> 26 <hr /> 27 </div> 28 <div class="chapter" lang="en" xml:lang="en"> 29 <div class="titlepage"> 30 <div> 31 <div> 32 <h2 class="title"><a id="introduction"></a>Chapter��1.��Introduction to Berkeley DB </h2> 33 </div> 34 </div> 35 <div></div> 36 </div> 37 <div class="toc"> 38 <p> 39 <b>Table of Contents</b> 40 </p> 41 <dl> 42 <dt> 43 <span class="sect1"> 44 <a href="introduction.html#aboutthismanual">About This Manual</a> 45 </span> 46 </dt> 47 <dt> 48 <span class="sect1"> 49 <a href="javadplconcepts.html">Berkeley DB Concepts</a> 50 </span> 51 </dt> 52 <dd> 53 <dl> 54 <dt> 55 <span class="sect2"> 56 <a href="javadplconcepts.html#dplenvconcepts">Environments</a> 57 </span> 58 </dt> 59 <dt> 60 <span class="sect2"> 61 <a href="javadplconcepts.html#key-data">Key-Data Pairs</a> 62 </span> 63 </dt> 64 <dt> 65 <span class="sect2"> 66 <a href="javadplconcepts.html#storing-intro">Storing Data</a> 67 </span> 68 </dt> 69 <dt> 70 <span class="sect2"> 71 <a href="javadplconcepts.html#duplicatesintro">Duplicate Data</a> 72 </span> 73 </dt> 74 <dt> 75 <span class="sect2"> 76 <a href="javadplconcepts.html#replacedeleteIntro">Replacing and Deleting Entries</a> 77 </span> 78 </dt> 79 <dt> 80 <span class="sect2"> 81 <a href="javadplconcepts.html#secondary">Secondary Keys</a> 82 </span> 83 </dt> 84 <dt> 85 <span class="sect2"> 86 <a href="javadplconcepts.html#whichapi">Which API Should You Use?</a> 87 </span> 88 </dt> 89 </dl> 90 </dd> 91 <dt> 92 <span class="sect1"> 93 <a href="accessmethods.html">Access Methods</a> 94 </span> 95 </dt> 96 <dd> 97 <dl> 98 <dt> 99 <span class="sect2"> 100 <a href="accessmethods.html#selectAM">Selecting Access Methods</a> 101 </span> 102 </dt> 103 <dt> 104 <span class="sect2"> 105 <a href="accessmethods.html#BTreeVSHash">Choosing between BTree and Hash</a> 106 </span> 107 </dt> 108 <dt> 109 <span class="sect2"> 110 <a href="accessmethods.html#QueueVSRecno">Choosing between Queue and Recno</a> 111 </span> 112 </dt> 113 </dl> 114 </dd> 115 <dt> 116 <span class="sect1"> 117 <a href="databaseLimits.html">Database Limits and Portability</a> 118 </span> 119 </dt> 120 <dt> 121 <span class="sect1"> 122 <a href="coreExceptions.html">Exception Handling</a> 123 </span> 124 </dt> 125 <dt> 126 <span class="sect1"> 127 <a href="returns.html">Error Returns</a> 128 </span> 129 </dt> 130 <dt> 131 <span class="sect1"> 132 <a href="gettingit.html">Getting and Using DB </a> 133 </span> 134 </dt> 135 </dl> 136 </div> 137 <p> 138 Welcome to Berkeley DB (DB). DB is a general-purpose embedded 139 database engine that is capable of providing a wealth of data management services. 140 It is designed from the ground up for high-throughput applications requiring 141 in-process, bullet-proof management of mission-critical data. DB can 142 gracefully scale from managing a few bytes to terabytes of data. For the most 143 part, DB is limited only by your system's available physical resources. 144 </p> 145 <p> 146 You use DB through a series of Java APIs which give you the 147 ability to read and write your data, manage your database(s), and 148 perform other more advanced activities such as managing 149 transactions. 150 <span> 151 The Java APIs that you use to interact with DB 152 come in two basic flavors. The first is a high-level API that 153 allows you to make Java classes persistent. The second is a 154 lower-level API which provides additional flexibility when interacting 155 with DB databases. 156 </span> 157 </p> 158 <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 159 <h3 class="title">Note</h3> 160 <p> 161 For long-time users of DB, the lower-level API is the 162 traditional API that you are probably accustomed to using. 163 </p> 164 </div> 165 <p> 166 Because DB is an embedded database engine, it is extremely fast. You compile 167 and link it into your application in the same way as you would any 168 third-party library. This means that DB runs in the same process space 169 as does your application, allowing you to avoid the high cost of 170 interprocess communications incurred by stand-alone database servers. 171 </p> 172 <p> 173 To further improve performance, DB offers an in-memory cache designed to 174 provide rapid access to your most frequently used data. Once configured, 175 cache usage is transparent. It requires very little attention on the part 176 of the application developer. 177 </p> 178 <p> 179 Beyond raw speed, DB is also extremely configurable. It provides several 180 different ways of organizing your data in its databases. Known as 181 <span class="emphasis"><em>access methods</em></span>, each such data organization mechanism 182 provides different characteristics that are appropriate for different data 183 management profiles. (Note that this manual focuses almost entirely on the 184 BTree access method as this is the access method used by the vast majority 185 of DB applications). 186 </p> 187 <p> 188 To further improve its configurability, DB offers many different 189 subsystems, each of which can be used to extend DB's capabilities. For 190 example, many applications require write-protection of their data so 191 as to ensure that data is never left in an inconsistent state for any 192 reason (such as software bugs or hardware failures). For those 193 applications, a transaction subsystem can be enabled and used to 194 transactional-protect database writes. 195 </p> 196 <p> 197 The list of operating systems on which DB is available is too long to 198 detail here. Suffice to say that it is available on all major commercial 199 operating systems, as well as on many embedded platforms. 200 </p> 201 <p> 202 Finally, DB is available in a wealth of programming languages. 203 DB is officially supported in C, C++, and Java, but the library is also 204 available in many other languages, especially scripting languages such as 205 Perl and Python. 206 </p> 207 <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 208 <h3 class="title">Note</h3> 209 <p> 210 Before going any further, it is important to mention that DB is not 211 a relational database (although you could use it to build a relational 212 database). Out of the box, DB does not provide higher-level features 213 such as triggers, or a high-level query language such as SQL. 214 Instead, DB provides just those minimal 215 APIs required to store and retrieve your data as 216 efficiently as possible. 217 </p> 218 </div> 219 <div class="sect1" lang="en" xml:lang="en"> 220 <div class="titlepage"> 221 <div> 222 <div> 223 <h2 class="title" style="clear: both"><a id="aboutthismanual"></a>About This Manual</h2> 224 </div> 225 </div> 226 <div></div> 227 </div> 228 <p> 229 This manual introduces DB. As such, this book does not examine 230 intermediate or advanced features such as threaded library usage or 231 transactional usage. Instead, this manual provides a step-by-step 232 introduction to DB's basic concepts and library usage. 233 </p> 234 <p> 235 Specifically, this manual introduces the high-level Java API 236 (the DPL), as well as the "base" Java API that the DPL 237 relies upon. Regardless of the API set that you choose to use, there are a 238 series of concepts and APIs that are common across the product. 239 This manual starts by providing a high-level examination of 240 DB. It then describes the APIs you use regardless of the API 241 set that you choose to use. It then provides information on using the 242 Direct Persistence Layer (DPL) API, followed by information on using 243 the more extensive "base" API. 244 </p> 245 <p> 246 Examples are given throughout this book that are designed to illustrate 247 API usage. At the end of each 248 249 <span>chapter or section in this book,</span> 250 a complete example is given that 251 is designed to reinforce the concepts covered in that 252 253 <span>chapter or section.</span> 254 In addition to being presented in this book, these final programs are also 255 available in the DB software distribution. You can find them in 256 </p> 257 <pre class="programlisting"><span class="emphasis"><em>DB_INSTALL</em></span>/examples_java/db/GettingStarted</pre> 258 <p> 259 where <tt class="literal"><span class="emphasis"><em>DB_INSTALL</em></span></tt> is the 260 location where you placed your DB distribution. 261 </p> 262 <p> 263 This book uses the Java programming languages for its examples. 264 Note that versions of this book exist for the C and C++ languages as 265 well. 266 </p> 267 </div> 268 </div> 269 <div class="navfooter"> 270 <hr /> 271 <table width="100%" summary="Navigation footer"> 272 <tr> 273 <td width="40%" align="left"><a accesskey="p" href="preface.html">Prev</a>��</td> 274 <td width="20%" align="center"> 275 <a accesskey="u" href="index.html">Up</a> 276 </td> 277 <td width="40%" align="right">��<a accesskey="n" href="javadplconcepts.html">Next</a></td> 278 </tr> 279 <tr> 280 <td width="40%" align="left" valign="top">Preface��</td> 281 <td width="20%" align="center"> 282 <a accesskey="h" href="index.html">Home</a> 283 </td> 284 <td width="40%" align="right" valign="top">��Berkeley DB Concepts</td> 285 </tr> 286 </table> 287 </div> 288 </body> 289</html> 290