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>Getting Started with 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="next" href="preface.html" title="Preface" />
11  </head>
12  <body>
13    <div class="navheader">
14      <table width="100%" summary="Navigation header">
15        <tr>
16          <th colspan="3" align="center">Getting Started with Berkeley DB</th>
17        </tr>
18        <tr>
19          <td width="20%" align="left"> </td>
20          <th width="60%" align="center"> </th>
21          <td width="20%" align="right"> <a accesskey="n" href="preface.html">Next</a></td>
22        </tr>
23      </table>
24      <hr />
25    </div>
26    <div class="book" lang="en" xml:lang="en">
27      <div class="titlepage">
28        <div>
29          <div>
30            <h1 class="title"><a id="id613728"></a>Getting Started with Berkeley DB</h1>
31          </div>
32          <div>
33            <div class="legalnotice">
34              <p class="legalnotice-title">
35                <b>Legal Notice</b>
36              </p>
37              <p>
38        This documentation is distributed under an open source license.
39        You may review the terms of this license at:
40        <a href="http://www.oracle.com/technology/software/products/berkeley-db/htdocs/oslicense.html" target="_top">http://www.oracle.com/technology/software/products/berkeley-db/htdocs/oslicense.html</a>
41        
42        
43    </p>
44              <p>
45            Oracle, Berkeley DB,
46            
47            
48            and
49            Sleepycat are trademarks or registered trademarks of
50            Oracle. All rights to these marks are reserved.
51            No third-party use is permitted without the
52            express prior written consent of Oracle.
53    </p>
54              <p>
55        To obtain a copy of this document's original source code, please
56        submit a request to the Oracle Technology Network forum at:
57        <a href="http://forums.oracle.com/forums/forum.jspa?forumID=271" target="_top">http://forums.oracle.com/forums/forum.jspa?forumID=271</a>
58        
59        
60    </p>
61            </div>
62          </div>
63          <div>
64            <p class="pubdate">4/25/2008</p>
65          </div>
66        </div>
67        <div></div>
68        <hr />
69      </div>
70      <div class="toc">
71        <p>
72          <b>Table of Contents</b>
73        </p>
74        <dl>
75          <dt>
76            <span class="preface">
77              <a href="preface.html">Preface</a>
78            </span>
79          </dt>
80          <dd>
81            <dl>
82              <dt>
83                <span class="sect1">
84                  <a href="preface.html#conventions">Conventions Used in this Book</a>
85                </span>
86              </dt>
87              <dd>
88                <dl>
89                  <dt>
90                    <span class="sect2">
91                      <a href="preface.html#moreinfo">For More Information</a>
92                    </span>
93                  </dt>
94                </dl>
95              </dd>
96            </dl>
97          </dd>
98          <dt>
99            <span class="chapter">
100              <a href="introduction.html">1. Introduction to Berkeley DB </a>
101            </span>
102          </dt>
103          <dd>
104            <dl>
105              <dt>
106                <span class="sect1">
107                  <a href="introduction.html#aboutthismanual">About This Manual</a>
108                </span>
109              </dt>
110              <dt>
111                <span class="sect1">
112                  <a href="concepts.html">Berkeley DB Concepts</a>
113                </span>
114              </dt>
115              <dt>
116                <span class="sect1">
117                  <a href="accessmethods.html">Access Methods</a>
118                </span>
119              </dt>
120              <dd>
121                <dl>
122                  <dt>
123                    <span class="sect2">
124                      <a href="accessmethods.html#selectAM">Selecting Access Methods</a>
125                    </span>
126                  </dt>
127                  <dt>
128                    <span class="sect2">
129                      <a href="accessmethods.html#BTreeVSHash">Choosing between BTree and Hash</a>
130                    </span>
131                  </dt>
132                  <dt>
133                    <span class="sect2">
134                      <a href="accessmethods.html#QueueVSRecno">Choosing between Queue and Recno</a>
135                    </span>
136                  </dt>
137                </dl>
138              </dd>
139              <dt>
140                <span class="sect1">
141                  <a href="databaseLimits.html">Database Limits and Portability</a>
142                </span>
143              </dt>
144              <dt>
145                <span class="sect1">
146                  <a href="environments.html">Environments</a>
147                </span>
148              </dt>
149              <dt>
150                <span class="sect1">
151                  <a href="coreExceptions.html">Exception Handling</a>
152                </span>
153              </dt>
154              <dt>
155                <span class="sect1">
156                  <a href="returns.html">Error Returns</a>
157                </span>
158              </dt>
159              <dt>
160                <span class="sect1">
161                  <a href="gettingit.html">Getting and Using DB </a>
162                </span>
163              </dt>
164            </dl>
165          </dd>
166          <dt>
167            <span class="chapter">
168              <a href="DB.html">2. Databases</a>
169            </span>
170          </dt>
171          <dd>
172            <dl>
173              <dt>
174                <span class="sect1">
175                  <a href="DB.html#DBOpen">Opening Databases</a>
176                </span>
177              </dt>
178              <dt>
179                <span class="sect1">
180                  <a href="coredbclose.html">Closing Databases</a>
181                </span>
182              </dt>
183              <dt>
184                <span class="sect1">
185                  <a href="DBOpenFlags.html">Database Open Flags</a>
186                </span>
187              </dt>
188              <dt>
189                <span class="sect1">
190                  <a href="CoreDBAdmin.html">Administrative Methods</a>
191                </span>
192              </dt>
193              <dt>
194                <span class="sect1">
195                  <a href="dbErrorReporting.html">Error Reporting Functions</a>
196                </span>
197              </dt>
198              <dt>
199                <span class="sect1">
200                  <a href="CoreEnvUsage.html">Managing Databases in Environments</a>
201                </span>
202              </dt>
203              <dt>
204                <span class="sect1">
205                  <a href="CoreDbCXXUsage.html">Database Example</a>
206                </span>
207              </dt>
208            </dl>
209          </dd>
210          <dt>
211            <span class="chapter">
212              <a href="DBEntry.html">3. Database Records</a>
213            </span>
214          </dt>
215          <dd>
216            <dl>
217              <dt>
218                <span class="sect1">
219                  <a href="DBEntry.html#usingDbEntry">Using Database Records</a>
220                </span>
221              </dt>
222              <dt>
223                <span class="sect1">
224                  <a href="usingDbt.html">Reading and Writing Database Records</a>
225                </span>
226              </dt>
227              <dd>
228                <dl>
229                  <dt>
230                    <span class="sect2">
231                      <a href="usingDbt.html#databaseWrite">Writing Records to the Database</a>
232                    </span>
233                  </dt>
234                  <dt>
235                    <span class="sect2">
236                      <a href="usingDbt.html#CoreDatabaseRead">Getting Records from the Database</a>
237                    </span>
238                  </dt>
239                  <dt>
240                    <span class="sect2">
241                      <a href="usingDbt.html#recordDelete">Deleting Records</a>
242                    </span>
243                  </dt>
244                  <dt>
245                    <span class="sect2">
246                      <a href="usingDbt.html#datapersist">Data Persistence</a>
247                    </span>
248                  </dt>
249                </dl>
250              </dd>
251              <dt>
252                <span class="sect1">
253                  <a href="DbCXXUsage.html">Database Usage Example</a>
254                </span>
255              </dt>
256            </dl>
257          </dd>
258          <dt>
259            <span class="chapter">
260              <a href="Cursors.html">4. Using Cursors</a>
261            </span>
262          </dt>
263          <dd>
264            <dl>
265              <dt>
266                <span class="sect1">
267                  <a href="Cursors.html#openCursor">Opening and Closing Cursors</a>
268                </span>
269              </dt>
270              <dt>
271                <span class="sect1">
272                  <a href="Positioning.html">Getting Records Using the Cursor</a>
273                </span>
274              </dt>
275              <dd>
276                <dl>
277                  <dt>
278                    <span class="sect2">
279                      <a href="Positioning.html#cursorsearch">Searching for Records</a>
280                    </span>
281                  </dt>
282                  <dt>
283                    <span class="sect2">
284                      <a href="Positioning.html#getdups">Working with Duplicate Records</a>
285                    </span>
286                  </dt>
287                </dl>
288              </dd>
289              <dt>
290                <span class="sect1">
291                  <a href="PutEntryWCursor.html">Putting Records Using Cursors</a>
292                </span>
293              </dt>
294              <dt>
295                <span class="sect1">
296                  <a href="DeleteEntryWCursor.html">Deleting Records Using Cursors</a>
297                </span>
298              </dt>
299              <dt>
300                <span class="sect1">
301                  <a href="ReplacingEntryWCursor.html">Replacing Records Using Cursors</a>
302                </span>
303              </dt>
304              <dt>
305                <span class="sect1">
306                  <a href="CoreCursorUsage.html">Cursor Example</a>
307                </span>
308              </dt>
309            </dl>
310          </dd>
311          <dt>
312            <span class="chapter">
313              <a href="indexes.html">5. Secondary Databases</a>
314            </span>
315          </dt>
316          <dd>
317            <dl>
318              <dt>
319                <span class="sect1">
320                  <a href="indexes.html#CoreDbAssociate">Opening and Closing Secondary Databases</a>
321                </span>
322              </dt>
323              <dt>
324                <span class="sect1">
325                  <a href="keyCreator.html">Implementing Key 
326        
327        Extractors
328        </a>
329                </span>
330              </dt>
331              <dd>
332                <dl>
333                  <dt>
334                    <span class="sect2">
335                      <a href="keyCreator.html#multikeys">Working with Multiple Keys</a>
336                    </span>
337                  </dt>
338                </dl>
339              </dd>
340              <dt>
341                <span class="sect1">
342                  <a href="readSecondary.html">Reading Secondary Databases</a>
343                </span>
344              </dt>
345              <dt>
346                <span class="sect1">
347                  <a href="secondaryDelete.html">Deleting Secondary Database Records</a>
348                </span>
349              </dt>
350              <dt>
351                <span class="sect1">
352                  <a href="secondaryCursor.html">
353        
354        Using Cursors with Secondary Databases
355    </a>
356                </span>
357              </dt>
358              <dt>
359                <span class="sect1">
360                  <a href="joins.html">Database Joins</a>
361                </span>
362              </dt>
363              <dd>
364                <dl>
365                  <dt>
366                    <span class="sect2">
367                      <a href="joins.html#joinUsage">Using Join Cursors</a>
368                    </span>
369                  </dt>
370                </dl>
371              </dd>
372              <dt>
373                <span class="sect1">
374                  <a href="coreindexusage.html">Secondary Database Example</a>
375                </span>
376              </dt>
377              <dd>
378                <dl>
379                  <dt>
380                    <span class="sect2">
381                      <a href="coreindexusage.html#edlWIndexes">Secondary Databases with example_database_load</a>
382                    </span>
383                  </dt>
384                  <dt>
385                    <span class="sect2">
386                      <a href="coreindexusage.html#edrWIndexes">Secondary Databases with example_database_read</a>
387                    </span>
388                  </dt>
389                </dl>
390              </dd>
391            </dl>
392          </dd>
393          <dt>
394            <span class="chapter">
395              <a href="dbconfig.html">6. Database Configuration</a>
396            </span>
397          </dt>
398          <dd>
399            <dl>
400              <dt>
401                <span class="sect1">
402                  <a href="dbconfig.html#pagesize">Setting the Page Size</a>
403                </span>
404              </dt>
405              <dd>
406                <dl>
407                  <dt>
408                    <span class="sect2">
409                      <a href="dbconfig.html#overflowpages">Overflow Pages</a>
410                    </span>
411                  </dt>
412                  <dt>
413                    <span class="sect2">
414                      <a href="dbconfig.html#Locking">Locking</a>
415                    </span>
416                  </dt>
417                  <dt>
418                    <span class="sect2">
419                      <a href="dbconfig.html#IOEfficiency">IO Efficiency</a>
420                    </span>
421                  </dt>
422                  <dt>
423                    <span class="sect2">
424                      <a href="dbconfig.html#pagesizeAdvice">Page Sizing Advice</a>
425                    </span>
426                  </dt>
427                </dl>
428              </dd>
429              <dt>
430                <span class="sect1">
431                  <a href="cachesize.html">Selecting the Cache Size</a>
432                </span>
433              </dt>
434              <dt>
435                <span class="sect1">
436                  <a href="btree.html">BTree Configuration</a>
437                </span>
438              </dt>
439              <dd>
440                <dl>
441                  <dt>
442                    <span class="sect2">
443                      <a href="btree.html#duplicateRecords">Allowing Duplicate Records</a>
444                    </span>
445                  </dt>
446                  <dt>
447                    <span class="sect2">
448                      <a href="btree.html#comparators">Setting Comparison Functions</a>
449                    </span>
450                  </dt>
451                </dl>
452              </dd>
453            </dl>
454          </dd>
455        </dl>
456      </div>
457      <div class="list-of-examples">
458        <p>
459          <b>List of Examples</b>
460        </p>
461        <dl>
462          <dt>2.1. <a href="CoreDbCXXUsage.html#MyDb-cxx">MyDb Class</a></dt>
463          <dt>3.1. <a href="DbCXXUsage.html#VENDORCXXStruct">VENDOR Structure</a></dt>
464          <dt>3.2. <a href="DbCXXUsage.html#InventoryData">InventoryData Class</a></dt>
465          <dt>3.3. <a href="DbCXXUsage.html#exampledbload-cxx">example_database_load</a></dt>
466          <dt>4.1. <a href="CoreCursorUsage.html#CoreEIR-cxx">example_database_read</a></dt>
467        </dl>
468      </div>
469    </div>
470    <div class="navfooter">
471      <hr />
472      <table width="100%" summary="Navigation footer">
473        <tr>
474          <td width="40%" align="left"> </td>
475          <td width="20%" align="center"> </td>
476          <td width="40%" align="right"> <a accesskey="n" href="preface.html">Next</a></td>
477        </tr>
478        <tr>
479          <td width="40%" align="left" valign="top"> </td>
480          <td width="20%" align="center"> </td>
481          <td width="40%" align="right" valign="top"> Preface</td>
482        </tr>
483      </table>
484    </div>
485  </body>
486</html>
487