1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<!--NewPage--> 3<HTML> 4<HEAD> 5<!-- Generated by javadoc (build 1.5.0) on Thu May 15 17:17:30 EDT 2008 --> 6<TITLE> 7Database (Oracle - Berkeley DB Java API) 8</TITLE> 9 10<META NAME="keywords" CONTENT="com.sleepycat.db.Database class"> 11 12<LINK REL ="stylesheet" TYPE="text/css" HREF="/style.css" TITLE="Style"> 13 14<SCRIPT type="text/javascript"> 15function windowTitle() 16{ 17 parent.document.title="Database (Oracle - Berkeley DB Java API)"; 18} 19</SCRIPT> 20<NOSCRIPT> 21</NOSCRIPT> 22 23</HEAD> 24 25<BODY BGCOLOR="white" onload="windowTitle();"> 26 27 28<!-- ========= START OF TOP NAVBAR ======= --> 29<A NAME="navbar_top"><!-- --></A> 30<A HREF="#skip-navbar_top" title="Skip navigation links"></A> 31<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 32<TR> 33<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 34<A NAME="navbar_top_firstrow"><!-- --></A> 35<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 36 <TR ALIGN="center" VALIGN="top"> 37 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 38 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 39 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 40 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Database.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 42 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 44 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 45 </TR> 46</TABLE> 47</TD> 48<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 49<b>Berkeley DB</b><br><font size="-1"> version 4.7.25</font></EM> 50</TD> 51</TR> 52 53<TR> 54<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 55 <A HREF="/com/sleepycat/db/CursorConfig.html" title="class in com.sleepycat.db"><B>PREV CLASS</B></A> 56 <A HREF="/com/sleepycat/db/DatabaseConfig.html" title="class in com.sleepycat.db"><B>NEXT CLASS</B></A></FONT></TD> 57<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 58 <A HREF="/index.html?com/sleepycat/db/Database.html" target="_top"><B>FRAMES</B></A> 59 <A HREF="Database.html" target="_top"><B>NO FRAMES</B></A> 60 <SCRIPT type="text/javascript"> 61 <!-- 62 if(window==top) { 63 document.writeln('<A HREF="/allclasses-noframe.html"><B>All Classes</B></A>'); 64 } 65 //--> 66</SCRIPT> 67<NOSCRIPT> 68 <A HREF="/allclasses-noframe.html"><B>All Classes</B></A> 69</NOSCRIPT> 70 71 72</FONT></TD> 73</TR> 74<TR> 75<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 76 SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> 77<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 78DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> 79</TR> 80</TABLE> 81<A NAME="skip-navbar_top"></A> 82<!-- ========= END OF TOP NAVBAR ========= --> 83 84<HR> 85<!-- ======== START OF CLASS DATA ======== --> 86<H2> 87<FONT SIZE="-1"> 88com.sleepycat.db</FONT> 89<BR> 90Class Database</H2> 91<PRE> 92<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">java.lang.Object</A> 93 <IMG SRC="/resources/inherit.gif" ALT="extended by "><B>com.sleepycat.db.Database</B> 94</PRE> 95<DL> 96<DT><B>Direct Known Subclasses:</B> <DD><A HREF="/com/sleepycat/db/SecondaryDatabase.html" title="class in com.sleepycat.db">SecondaryDatabase</A></DD> 97</DL> 98<HR> 99<DL> 100<DT><PRE>public class <B>Database</B><DT>extends <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></DL> 101</PRE> 102 103<P> 104A database handle. 105<p> 106Database attributes are specified in the <A HREF="/com/sleepycat/db/DatabaseConfig.html" title="class in com.sleepycat.db"><CODE>DatabaseConfig</CODE></A> class. 107<p> 108Database handles are free-threaded unless opened in an environment 109that is not free-threaded. 110<p> 111To open an existing database with default attributes: 112<blockquote><pre> 113 Environment env = new Environment(home, null); 114 Database myDatabase = env.openDatabase(null, "mydatabase", null); 115</pre></blockquote> 116To create a transactional database that supports duplicates: 117<blockquote><pre> 118 DatabaseConfig dbConfig = new DatabaseConfig(); 119 dbConfig.setTransactional(true); 120 dbConfig.setAllowCreate(true); 121 dbConfig.setSortedDuplicates(true); 122 Database newlyCreateDb = env.openDatabase(txn, "mydatabase", dbConfig); 123</pre></blockquote> 124<P> 125 126<P> 127<HR> 128 129<P> 130 131<!-- ======== CONSTRUCTOR SUMMARY ======== --> 132 133<A NAME="constructor_summary"><!-- --></A> 134<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 135<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 136<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 137<B>Constructor Summary</B></FONT></TH> 138</TR> 139<TR BGCOLOR="white" CLASS="TableRowColor"> 140<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#Database(java.lang.String, java.lang.String, com.sleepycat.db.DatabaseConfig)">Database</A></B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> filename, 141 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> databaseName, 142 <A HREF="/com/sleepycat/db/DatabaseConfig.html" title="class in com.sleepycat.db">DatabaseConfig</A> config)</CODE> 143 144<BR> 145 Open a database.</TD> 146</TR> 147</TABLE> 148 149<!-- ========== METHOD SUMMARY =========== --> 150 151<A NAME="method_summary"><!-- --></A> 152<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 153<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 154<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 155<B>Method Summary</B></FONT></TH> 156</TR> 157<TR BGCOLOR="white" CLASS="TableRowColor"> 158<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 159<CODE> <A HREF="/com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</A></CODE></FONT></TD> 160<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#append(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry)">append</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 161 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key, 162 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> data)</CODE> 163 164<BR> 165 166Append the key/data pair to the end of the database.</TD> 167</TR> 168<TR BGCOLOR="white" CLASS="TableRowColor"> 169<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 170<CODE> void</CODE></FONT></TD> 171<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#close()">close</A></B>()</CODE> 172 173<BR> 174 Flush any cached database information to disk and discard the database 175handle.</TD> 176</TR> 177<TR BGCOLOR="white" CLASS="TableRowColor"> 178<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 179<CODE> void</CODE></FONT></TD> 180<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#close(boolean)">close</A></B>(boolean noSync)</CODE> 181 182<BR> 183 Flush any cached database information to disk and discard the database 184handle.</TD> 185</TR> 186<TR BGCOLOR="white" CLASS="TableRowColor"> 187<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 188<CODE> <A HREF="/com/sleepycat/db/CompactStats.html" title="class in com.sleepycat.db">CompactStats</A></CODE></FONT></TD> 189<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#compact(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.CompactConfig)">compact</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 190 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> start, 191 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> stop, 192 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> end, 193 <A HREF="/com/sleepycat/db/CompactConfig.html" title="class in com.sleepycat.db">CompactConfig</A> config)</CODE> 194 195<BR> 196 Compact a Btree or Recno database or returns unused Btree, 197 Hash or Recno database pages to the underlying filesystem.</TD> 198</TR> 199<TR BGCOLOR="white" CLASS="TableRowColor"> 200<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 201<CODE> <A HREF="/com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</A></CODE></FONT></TD> 202<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#consume(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, boolean)">consume</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 203 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key, 204 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> data, 205 boolean wait)</CODE> 206 207<BR> 208 Return the record number and data from the available record closest to 209the head of the queue, and delete the record.</TD> 210</TR> 211<TR BGCOLOR="white" CLASS="TableRowColor"> 212<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 213<CODE> <A HREF="/com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</A></CODE></FONT></TD> 214<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#delete(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry)">delete</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 215 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key)</CODE> 216 217<BR> 218 Remove key/data pairs from the database.</TD> 219</TR> 220<TR BGCOLOR="white" CLASS="TableRowColor"> 221<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 222<CODE> <A HREF="/com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</A></CODE></FONT></TD> 223<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#exists(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry)">exists</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 224 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key)</CODE> 225 226<BR> 227 Checks if the specified key appears in the database.</TD> 228</TR> 229<TR BGCOLOR="white" CLASS="TableRowColor"> 230<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 231<CODE> <A HREF="/com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</A></CODE></FONT></TD> 232<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#get(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.LockMode)">get</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 233 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key, 234 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> data, 235 <A HREF="/com/sleepycat/db/LockMode.html" title="class in com.sleepycat.db">LockMode</A> lockMode)</CODE> 236 237<BR> 238 Retrieves the key/data pair with the given key.</TD> 239</TR> 240<TR BGCOLOR="white" CLASS="TableRowColor"> 241<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 242<CODE> <A HREF="/com/sleepycat/db/CacheFile.html" title="class in com.sleepycat.db">CacheFile</A></CODE></FONT></TD> 243<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#getCacheFile()">getCacheFile</A></B>()</CODE> 244 245<BR> 246 Return the handle for the cache file underlying the database.</TD> 247</TR> 248<TR BGCOLOR="white" CLASS="TableRowColor"> 249<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 250<CODE> <A HREF="/com/sleepycat/db/DatabaseConfig.html" title="class in com.sleepycat.db">DatabaseConfig</A></CODE></FONT></TD> 251<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#getConfig()">getConfig</A></B>()</CODE> 252 253<BR> 254 Return this Database object's configuration.</TD> 255</TR> 256<TR BGCOLOR="white" CLASS="TableRowColor"> 257<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 258<CODE> <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD> 259<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#getDatabaseFile()">getDatabaseFile</A></B>()</CODE> 260 261<BR> 262 Return the database's underlying file name.</TD> 263</TR> 264<TR BGCOLOR="white" CLASS="TableRowColor"> 265<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 266<CODE> <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD> 267<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#getDatabaseName()">getDatabaseName</A></B>()</CODE> 268 269<BR> 270 Return the database name.</TD> 271</TR> 272<TR BGCOLOR="white" CLASS="TableRowColor"> 273<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 274<CODE> <A HREF="/com/sleepycat/db/Environment.html" title="class in com.sleepycat.db">Environment</A></CODE></FONT></TD> 275<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#getEnvironment()">getEnvironment</A></B>()</CODE> 276 277<BR> 278 Return the <A HREF="/com/sleepycat/db/Environment.html" title="class in com.sleepycat.db"><CODE>Environment</CODE></A> handle for the database environment 279 underlying the <A HREF="/com/sleepycat/db/Database.html" title="class in com.sleepycat.db"><CODE>Database</CODE></A>.</TD> 280</TR> 281<TR BGCOLOR="white" CLASS="TableRowColor"> 282<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 283<CODE> <A HREF="/com/sleepycat/db/KeyRange.html" title="class in com.sleepycat.db">KeyRange</A></CODE></FONT></TD> 284<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#getKeyRange(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry)">getKeyRange</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 285 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key)</CODE> 286 287<BR> 288 Return an estimate of the proportion of keys in the database less 289 than, equal to, and greater than the specified key.</TD> 290</TR> 291<TR BGCOLOR="white" CLASS="TableRowColor"> 292<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 293<CODE> <A HREF="/com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</A></CODE></FONT></TD> 294<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#getSearchBoth(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.LockMode)">getSearchBoth</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 295 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key, 296 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> data, 297 <A HREF="/com/sleepycat/db/LockMode.html" title="class in com.sleepycat.db">LockMode</A> lockMode)</CODE> 298 299<BR> 300 Retrieves the key/data pair with the given key and data value, that is, both 301the key and data items must match.</TD> 302</TR> 303<TR BGCOLOR="white" CLASS="TableRowColor"> 304<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 305<CODE> <A HREF="/com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</A></CODE></FONT></TD> 306<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#getSearchRecordNumber(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.LockMode)">getSearchRecordNumber</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 307 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key, 308 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> data, 309 <A HREF="/com/sleepycat/db/LockMode.html" title="class in com.sleepycat.db">LockMode</A> lockMode)</CODE> 310 311<BR> 312 Retrieves the key/data pair associated with the specific numbered record of the database.</TD> 313</TR> 314<TR BGCOLOR="white" CLASS="TableRowColor"> 315<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 316<CODE> <A HREF="/com/sleepycat/db/DatabaseStats.html" title="class in com.sleepycat.db">DatabaseStats</A></CODE></FONT></TD> 317<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#getStats(com.sleepycat.db.Transaction, com.sleepycat.db.StatsConfig)">getStats</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 318 <A HREF="/com/sleepycat/db/StatsConfig.html" title="class in com.sleepycat.db">StatsConfig</A> config)</CODE> 319 320<BR> 321 Return database statistics.</TD> 322</TR> 323<TR BGCOLOR="white" CLASS="TableRowColor"> 324<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 325<CODE> <A HREF="/com/sleepycat/db/JoinCursor.html" title="class in com.sleepycat.db">JoinCursor</A></CODE></FONT></TD> 326<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#join(com.sleepycat.db.Cursor[], com.sleepycat.db.JoinConfig)">join</A></B>(<A HREF="/com/sleepycat/db/Cursor.html" title="class in com.sleepycat.db">Cursor</A>[] cursors, 327 <A HREF="/com/sleepycat/db/JoinConfig.html" title="class in com.sleepycat.db">JoinConfig</A> config)</CODE> 328 329<BR> 330 Creates a specialized join cursor for use in performing equality or 331 natural joins on secondary indices.</TD> 332</TR> 333<TR BGCOLOR="white" CLASS="TableRowColor"> 334<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 335<CODE> <A HREF="/com/sleepycat/db/Cursor.html" title="class in com.sleepycat.db">Cursor</A></CODE></FONT></TD> 336<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#openCursor(com.sleepycat.db.Transaction, com.sleepycat.db.CursorConfig)">openCursor</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 337 <A HREF="/com/sleepycat/db/CursorConfig.html" title="class in com.sleepycat.db">CursorConfig</A> config)</CODE> 338 339<BR> 340 Return a cursor into the database.</TD> 341</TR> 342<TR BGCOLOR="white" CLASS="TableRowColor"> 343<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 344<CODE> <A HREF="/com/sleepycat/db/Sequence.html" title="class in com.sleepycat.db">Sequence</A></CODE></FONT></TD> 345<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#openSequence(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.SequenceConfig)">openSequence</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 346 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key, 347 <A HREF="/com/sleepycat/db/SequenceConfig.html" title="class in com.sleepycat.db">SequenceConfig</A> config)</CODE> 348 349<BR> 350 Open a sequence in the database.</TD> 351</TR> 352<TR BGCOLOR="white" CLASS="TableRowColor"> 353<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 354<CODE> <A HREF="/com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</A></CODE></FONT></TD> 355<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#put(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry)">put</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 356 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key, 357 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> data)</CODE> 358 359<BR> 360 361Store the key/data pair into the database.</TD> 362</TR> 363<TR BGCOLOR="white" CLASS="TableRowColor"> 364<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 365<CODE> <A HREF="/com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</A></CODE></FONT></TD> 366<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#putNoDupData(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry)">putNoDupData</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 367 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key, 368 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> data)</CODE> 369 370<BR> 371 372Store the key/data pair into the database if it does not already appear 373in the database.</TD> 374</TR> 375<TR BGCOLOR="white" CLASS="TableRowColor"> 376<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 377<CODE> <A HREF="/com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</A></CODE></FONT></TD> 378<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#putNoOverwrite(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry)">putNoOverwrite</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 379 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key, 380 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> data)</CODE> 381 382<BR> 383 384Store the key/data pair into the database if the key does not already 385appear in the database.</TD> 386</TR> 387<TR BGCOLOR="white" CLASS="TableRowColor"> 388<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 389<CODE>static void</CODE></FONT></TD> 390<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#remove(java.lang.String, java.lang.String, com.sleepycat.db.DatabaseConfig)">remove</A></B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> fileName, 391 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> databaseName, 392 <A HREF="/com/sleepycat/db/DatabaseConfig.html" title="class in com.sleepycat.db">DatabaseConfig</A> config)</CODE> 393 394<BR> 395 396Remove a database.</TD> 397</TR> 398<TR BGCOLOR="white" CLASS="TableRowColor"> 399<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 400<CODE> void</CODE></FONT></TD> 401<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#removeSequence(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.SequenceConfig)">removeSequence</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 402 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key, 403 <A HREF="/com/sleepycat/db/SequenceConfig.html" title="class in com.sleepycat.db">SequenceConfig</A> config)</CODE> 404 405<BR> 406 Remove the sequence from the database.</TD> 407</TR> 408<TR BGCOLOR="white" CLASS="TableRowColor"> 409<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 410<CODE>static void</CODE></FONT></TD> 411<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#rename(java.lang.String, java.lang.String, java.lang.String, com.sleepycat.db.DatabaseConfig)">rename</A></B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> fileName, 412 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> oldDatabaseName, 413 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> newDatabaseName, 414 <A HREF="/com/sleepycat/db/DatabaseConfig.html" title="class in com.sleepycat.db">DatabaseConfig</A> config)</CODE> 415 416<BR> 417 418Rename a database.</TD> 419</TR> 420<TR BGCOLOR="white" CLASS="TableRowColor"> 421<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 422<CODE> void</CODE></FONT></TD> 423<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#setConfig(com.sleepycat.db.DatabaseConfig)">setConfig</A></B>(<A HREF="/com/sleepycat/db/DatabaseConfig.html" title="class in com.sleepycat.db">DatabaseConfig</A> config)</CODE> 424 425<BR> 426 Change the settings in an existing database handle.</TD> 427</TR> 428<TR BGCOLOR="white" CLASS="TableRowColor"> 429<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 430<CODE> void</CODE></FONT></TD> 431<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#sync()">sync</A></B>()</CODE> 432 433<BR> 434 Flush any cached information to disk.</TD> 435</TR> 436<TR BGCOLOR="white" CLASS="TableRowColor"> 437<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 438<CODE> int</CODE></FONT></TD> 439<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#truncate(com.sleepycat.db.Transaction, boolean)">truncate</A></B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 440 boolean countRecords)</CODE> 441 442<BR> 443 Empty the database, discarding all records it contains.</TD> 444</TR> 445<TR BGCOLOR="white" CLASS="TableRowColor"> 446<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 447<CODE>static void</CODE></FONT></TD> 448<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#upgrade(java.lang.String, com.sleepycat.db.DatabaseConfig)">upgrade</A></B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> fileName, 449 <A HREF="/com/sleepycat/db/DatabaseConfig.html" title="class in com.sleepycat.db">DatabaseConfig</A> config)</CODE> 450 451<BR> 452 Upgrade all of the databases included in the specified file.</TD> 453</TR> 454<TR BGCOLOR="white" CLASS="TableRowColor"> 455<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 456<CODE>static boolean</CODE></FONT></TD> 457<TD><CODE><B><A HREF="/com/sleepycat/db/Database.html#verify(java.lang.String, java.lang.String, java.io.PrintStream, com.sleepycat.db.VerifyConfig, com.sleepycat.db.DatabaseConfig)">verify</A></B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> fileName, 458 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> databaseName, 459 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/io/PrintStream.html" title="class or interface in java.io">PrintStream</A> dumpStream, 460 <A HREF="/com/sleepycat/db/VerifyConfig.html" title="class in com.sleepycat.db">VerifyConfig</A> verifyConfig, 461 <A HREF="/com/sleepycat/db/DatabaseConfig.html" title="class in com.sleepycat.db">DatabaseConfig</A> dbConfig)</CODE> 462 463<BR> 464 Return if all of the databases in a file are uncorrupted.</TD> 465</TR> 466</TABLE> 467 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> 468<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 469<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> 470<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></B></TH> 471</TR> 472<TR BGCOLOR="white" CLASS="TableRowColor"> 473<TD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD> 474</TR> 475</TABLE> 476 477<P> 478 479<!-- ========= CONSTRUCTOR DETAIL ======== --> 480 481<A NAME="constructor_detail"><!-- --></A> 482<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 483<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 484<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 485<B>Constructor Detail</B></FONT></TH> 486</TR> 487</TABLE> 488 489<A NAME="Database(java.lang.String, java.lang.String, com.sleepycat.db.DatabaseConfig)"><!-- --></A><H3> 490Database</H3> 491<PRE> 492public <B>Database</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> filename, 493 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> databaseName, 494 <A HREF="/com/sleepycat/db/DatabaseConfig.html" title="class in com.sleepycat.db">DatabaseConfig</A> config) 495 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A>, 496 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/io/FileNotFoundException.html" title="class or interface in java.io">FileNotFoundException</A></PRE> 497<DL> 498<DD>Open a database. 499<p> 500The database is represented by the file and database parameters. 501<p> 502The currently supported database file formats (or <em>access 503methods</em>) are Btree, Hash, Queue, and Recno. The Btree format is a 504representation of a sorted, balanced tree structure. The Hash format 505is an extensible, dynamic hashing scheme. The Queue format supports 506fast access to fixed-length records accessed sequentially or by logical 507record number. The Recno format supports fixed- or variable-length 508records, accessed sequentially or by logical record number, and 509optionally backed by a flat text file. 510<p> 511Storage and retrieval are based on key/data pairs; see <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db"><CODE>DatabaseEntry</CODE></A> 512for more information. 513<p> 514Opening a database is a relatively expensive operation, and maintaining 515a set of open databases will normally be preferable to repeatedly 516opening and closing the database for each new query. 517<p> 518In-memory databases never intended to be preserved on disk may be 519created by setting both the fileName and databaseName parameters to 520null. Note that in-memory databases can only ever be shared by sharing 521the single database handle that created them, in circumstances where 522doing so is safe. The environment variable <code>TMPDIR</code> may 523be used as a directory in which to create temporary backing files. 524<p> 525<P> 526<DL> 527<DT><B>Parameters:</B><DD><CODE>filename</CODE> - The name of an underlying file that will be used to back the database. 528On Windows platforms, this argument will be interpreted as a UTF-8 529string, which is equivalent to ASCII for Latin characters. 530<p><DD><CODE>databaseName</CODE> - An optional parameter that allows applications to have multiple 531databases in a single file. Although no databaseName parameter needs 532to be specified, it is an error to attempt to open a second database in 533a physical file that was not initially created using a databaseName 534parameter. Further, the databaseName parameter is not supported by the 535Queue format. 536<p><DD><CODE>config</CODE> - The database open attributes. If null, default attributes are used. 537<DT><B>Throws:</B> 538<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> 539<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/io/FileNotFoundException.html" title="class or interface in java.io">FileNotFoundException</A></CODE></DL> 540</DL> 541 542<!-- ============ METHOD DETAIL ========== --> 543 544<A NAME="method_detail"><!-- --></A> 545<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 546<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 547<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 548<B>Method Detail</B></FONT></TH> 549</TR> 550</TABLE> 551 552<A NAME="close(boolean)"><!-- --></A><H3> 553close</H3> 554<PRE> 555public void <B>close</B>(boolean noSync) 556 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 557<DL> 558<DD>Flush any cached database information to disk and discard the database 559handle. 560<p> 561The database handle should not be closed while any other handle that 562refers to it is not yet closed; for example, database handles should not 563be closed while cursor handles into the database remain open, or 564transactions that include operations on the database have not yet been 565committed or aborted. Specifically, this includes <A HREF="/com/sleepycat/db/Cursor.html" title="class in com.sleepycat.db"><CODE>Cursor</CODE></A> and 566<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db"><CODE>Transaction</CODE></A> handles. 567<p> 568Because key/data pairs are cached in memory, failing to sync the file 569with the <A HREF="/com/sleepycat/db/Database.html#close(boolean)"><CODE>Database.close</CODE></A> or <A HREF="/com/sleepycat/db/Database.html#sync()"><CODE>Database.sync</CODE></A> methods 570may result in inconsistent or lost information. 571<p> 572When multiple threads are using the <A HREF="/com/sleepycat/db/Database.html" title="class in com.sleepycat.db"><CODE>Database</CODE></A> handle 573concurrently, only a single thread may call this method. 574<p> 575The database handle may not be accessed again after this method is 576called, regardless of the method's success or failure. 577<p> 578When called on a database that is the primary database for a secondary 579index, the primary database should be closed only after all secondary 580indices which reference it have been closed. 581<P> 582<DD><DL> 583<DT><B>Parameters:</B><DD><CODE>noSync</CODE> - Do not flush cached information to disk. The noSync parameter is a 584dangerous option. It should be set only if the application is doing 585logging (with transactions) so that the database is recoverable after a 586system or application crash, or if the database is always generated from 587scratch after any system or application crash. 588<b> 589It is important to understand that flushing cached information to disk 590only minimizes the window of opportunity for corrupted data. 591<p> 592</b> 593Although unlikely, it is possible for database corruption to happen if 594a system or application crash occurs while writing data to the database. 595To ensure that database corruption never occurs, applications must 596either: use transactions and logging with automatic recovery; use 597logging and application-specific recovery; or edit a copy of the 598database, and once all applications using the database have successfully 599called this method, atomically replace the original database with the 600updated copy. 601<p> 602<p> 603<DT><B>Throws:</B> 604<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 605</DD> 606</DL> 607<HR> 608 609<A NAME="close()"><!-- --></A><H3> 610close</H3> 611<PRE> 612public void <B>close</B>() 613 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 614<DL> 615<DD>Flush any cached database information to disk and discard the database 616handle. 617<p> 618The database handle should not be closed while any other handle that 619refers to it is not yet closed; for example, database handles should not 620be closed while cursor handles into the database remain open, or 621transactions that include operations on the database have not yet been 622committed or aborted. Specifically, this includes <A HREF="/com/sleepycat/db/Cursor.html" title="class in com.sleepycat.db"><CODE>Cursor</CODE></A> and 623<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db"><CODE>Transaction</CODE></A> handles. 624<p> 625Because key/data pairs are cached in memory, failing to sync the file 626with the <A HREF="/com/sleepycat/db/Database.html#close(boolean)"><CODE>Database.close</CODE></A> or <A HREF="/com/sleepycat/db/Database.html#sync()"><CODE>Database.sync</CODE></A> methods 627may result in inconsistent or lost information. 628<p> 629When multiple threads are using the <A HREF="/com/sleepycat/db/Database.html" title="class in com.sleepycat.db"><CODE>Database</CODE></A> handle 630concurrently, only a single thread may call this method. 631<p> 632The database handle may not be accessed again after this method is 633called, regardless of the method's success or failure. 634<p> 635When called on a database that is the primary database for a secondary 636index, the primary database should be closed only after all secondary 637indices which reference it have been closed. 638<p> 639<p> 640<P> 641<DD><DL> 642 643<DT><B>Throws:</B> 644<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 645</DD> 646</DL> 647<HR> 648 649<A NAME="compact(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.CompactConfig)"><!-- --></A><H3> 650compact</H3> 651<PRE> 652public <A HREF="/com/sleepycat/db/CompactStats.html" title="class in com.sleepycat.db">CompactStats</A> <B>compact</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 653 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> start, 654 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> stop, 655 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> end, 656 <A HREF="/com/sleepycat/db/CompactConfig.html" title="class in com.sleepycat.db">CompactConfig</A> config) 657 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 658<DL> 659<DD>Compact a Btree or Recno database or returns unused Btree, 660 Hash or Recno database pages to the underlying filesystem. 661<P> 662<DD><DL> 663<DT><B>Parameters:</B><DD><CODE>txn</CODE> - If the operation is part of an application-specified transaction, the txnid 664 parameter is a transaction handle returned from <A HREF="/com/sleepycat/db/Environment.html#beginTransaction(com.sleepycat.db.Transaction, com.sleepycat.db.TransactionConfig)"><CODE>Environment.beginTransaction(com.sleepycat.db.Transaction, com.sleepycat.db.TransactionConfig)</CODE></A>, otherwise <code>null</code>. 665 If no transaction handle is specified, but the operation occurs in a 666 transactional database, the operation will be implicitly transaction 667 protected using multiple transactions. Transactions will be comitted at 668 points to avoid holding much of the tree locked. 669 Any deadlocks encountered will be cause the operation to retried from 670 the point of the last commit.<DD><CODE>start</CODE> - If not <code>null</code>, the <code>start</code> parameter is the starting 671 point for compaction in a Btree or Recno database. Compaction will start 672 at the smallest key greater than or equal to the specified key. If 673 <code>null</code>, compaction will start at the beginning of the database.<DD><CODE>stop</CODE> - If not <code>null</code>, the <code>stop</code> parameter is the stopping 674 point for compaction in a Btree or Recno database. Compaction will stop at 675 the page with the smallest key greater than the specified key. If 676 <code>null</code>, compaction will stop at the end of the database.<DD><CODE>end</CODE> - If not <code>null</code>, the <code>end</code> parameter will be filled in 677 with the key marking the end of the compaction operation in a Btree or 678 Recno database. It is generally the first key of the page where processing 679 stopped.<DD><CODE>config</CODE> - The compaction operation attributes. If null, default attributes are used. 680<DT><B>Throws:</B> 681<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 682</DD> 683</DL> 684<HR> 685 686<A NAME="openCursor(com.sleepycat.db.Transaction, com.sleepycat.db.CursorConfig)"><!-- --></A><H3> 687openCursor</H3> 688<PRE> 689public <A HREF="/com/sleepycat/db/Cursor.html" title="class in com.sleepycat.db">Cursor</A> <B>openCursor</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 690 <A HREF="/com/sleepycat/db/CursorConfig.html" title="class in com.sleepycat.db">CursorConfig</A> config) 691 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 692<DL> 693<DD>Return a cursor into the database. 694 <p> 695<P> 696<DD><DL> 697<DT><B>Parameters:</B><DD><CODE>txn</CODE> - To use a cursor for writing to a transactional database, an explicit 698 transaction must be specified. For read-only access to a transactional 699 database, the transaction may be null. For a non-transactional database, 700 the transaction must be null. 701 <p> 702 To transaction-protect cursor operations, cursors must be opened and closed 703 within the context of a transaction, and the txn parameter specifies the 704 transaction context in which the cursor will be used. 705 <p><DD><CODE>config</CODE> - The cursor attributes. If null, default attributes are used. 706 <p> 707<DT><B>Returns:</B><DD>A database cursor. 708 <p> 709<DT><B>Throws:</B> 710<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 711</DD> 712</DL> 713<HR> 714 715<A NAME="openSequence(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.SequenceConfig)"><!-- --></A><H3> 716openSequence</H3> 717<PRE> 718public <A HREF="/com/sleepycat/db/Sequence.html" title="class in com.sleepycat.db">Sequence</A> <B>openSequence</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 719 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key, 720 <A HREF="/com/sleepycat/db/SequenceConfig.html" title="class in com.sleepycat.db">SequenceConfig</A> config) 721 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 722<DL> 723<DD>Open a sequence in the database. 724 <p> 725<P> 726<DD><DL> 727<DT><B>Parameters:</B><DD><CODE>txn</CODE> - For a transactional database, an explicit transaction may be specified, or 728 null may be specified to use auto-commit. For a non-transactional 729 database, null must be specified. 730 <p><DD><CODE>key</CODE> - The key <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db"><CODE>DatabaseEntry</CODE></A> of the sequence. 731 <p><DD><CODE>config</CODE> - The sequence attributes. If null, default attributes are used. 732 <p> 733<DT><B>Returns:</B><DD>A sequence handle. 734 <p> 735<DT><B>Throws:</B> 736<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 737</DD> 738</DL> 739<HR> 740 741<A NAME="removeSequence(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.SequenceConfig)"><!-- --></A><H3> 742removeSequence</H3> 743<PRE> 744public void <B>removeSequence</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 745 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key, 746 <A HREF="/com/sleepycat/db/SequenceConfig.html" title="class in com.sleepycat.db">SequenceConfig</A> config) 747 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 748<DL> 749<DD>Remove the sequence from the database. This method should not be called if 750 there are open handles on this sequence. 751 <p> 752<P> 753<DD><DL> 754<DT><B>Parameters:</B><DD><CODE>txn</CODE> - For a transactional database, an explicit transaction may be specified, or 755 null may be specified to use auto-commit. For a non-transactional 756 database, null must be specified. 757 <p><DD><CODE>key</CODE> - The key <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db"><CODE>DatabaseEntry</CODE></A> of the sequence. 758 <p><DD><CODE>config</CODE> - The sequence attributes. If null, default attributes are used. 759<DT><B>Throws:</B> 760<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 761</DD> 762</DL> 763<HR> 764 765<A NAME="getDatabaseFile()"><!-- --></A><H3> 766getDatabaseFile</H3> 767<PRE> 768public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getDatabaseFile</B>() 769 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 770<DL> 771<DD>Return the database's underlying file name. 772<p> 773This method may be called at any time during the life of the application. 774<p> 775<P> 776<DD><DL> 777 778<DT><B>Returns:</B><DD>The database's underlying file name. 779<DT><B>Throws:</B> 780<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 781</DD> 782</DL> 783<HR> 784 785<A NAME="getDatabaseName()"><!-- --></A><H3> 786getDatabaseName</H3> 787<PRE> 788public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getDatabaseName</B>() 789 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 790<DL> 791<DD>Return the database name. 792<p> 793This method may be called at any time during the life of the application. 794<p> 795<P> 796<DD><DL> 797 798<DT><B>Returns:</B><DD>The database name. 799<DT><B>Throws:</B> 800<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 801</DD> 802</DL> 803<HR> 804 805<A NAME="getConfig()"><!-- --></A><H3> 806getConfig</H3> 807<PRE> 808public <A HREF="/com/sleepycat/db/DatabaseConfig.html" title="class in com.sleepycat.db">DatabaseConfig</A> <B>getConfig</B>() 809 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 810<DL> 811<DD>Return this Database object's configuration. 812 <p> 813 This may differ from the configuration used to open this object if 814 the database existed previously. 815 <p> 816<P> 817<DD><DL> 818 819<DT><B>Returns:</B><DD>This Database object's configuration. 820 <p> 821 <p> 822<DT><B>Throws:</B> 823<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 824</DD> 825</DL> 826<HR> 827 828<A NAME="setConfig(com.sleepycat.db.DatabaseConfig)"><!-- --></A><H3> 829setConfig</H3> 830<PRE> 831public void <B>setConfig</B>(<A HREF="/com/sleepycat/db/DatabaseConfig.html" title="class in com.sleepycat.db">DatabaseConfig</A> config) 832 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 833<DL> 834<DD>Change the settings in an existing database handle. 835 <p> 836<P> 837<DD><DL> 838<DT><B>Parameters:</B><DD><CODE>config</CODE> - The environment attributes. If null, default attributes are used. 839 <p> 840 <p> 841<DT><B>Throws:</B> 842<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if an invalid parameter was specified. 843<p> 844<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 845</DD> 846</DL> 847<HR> 848 849<A NAME="getEnvironment()"><!-- --></A><H3> 850getEnvironment</H3> 851<PRE> 852public <A HREF="/com/sleepycat/db/Environment.html" title="class in com.sleepycat.db">Environment</A> <B>getEnvironment</B>() 853 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 854<DL> 855<DD>Return the <A HREF="/com/sleepycat/db/Environment.html" title="class in com.sleepycat.db"><CODE>Environment</CODE></A> handle for the database environment 856 underlying the <A HREF="/com/sleepycat/db/Database.html" title="class in com.sleepycat.db"><CODE>Database</CODE></A>. 857<p> 858This method may be called at any time during the life of the application. 859<p> 860<P> 861<DD><DL> 862 863<DT><B>Returns:</B><DD>The <A HREF="/com/sleepycat/db/Environment.html" title="class in com.sleepycat.db"><CODE>Environment</CODE></A> handle for the database environment 864 underlying the <A HREF="/com/sleepycat/db/Database.html" title="class in com.sleepycat.db"><CODE>Database</CODE></A>. 865<p> 866<p> 867<DT><B>Throws:</B> 868<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 869</DD> 870</DL> 871<HR> 872 873<A NAME="getCacheFile()"><!-- --></A><H3> 874getCacheFile</H3> 875<PRE> 876public <A HREF="/com/sleepycat/db/CacheFile.html" title="class in com.sleepycat.db">CacheFile</A> <B>getCacheFile</B>() 877 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 878<DL> 879<DD>Return the handle for the cache file underlying the database. 880<p> 881This method may be called at any time during the life of the application. 882<p> 883<P> 884<DD><DL> 885 886<DT><B>Returns:</B><DD>The handle for the cache file underlying the database. 887<p> 888<p> 889<DT><B>Throws:</B> 890<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 891</DD> 892</DL> 893<HR> 894 895<A NAME="append(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry)"><!-- --></A><H3> 896append</H3> 897<PRE> 898public <A HREF="/com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</A> <B>append</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 899 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key, 900 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> data) 901 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 902<DL> 903<DD><p> 904Append the key/data pair to the end of the database. 905<p> 906The underlying database must be a Queue or Recno database. The record 907number allocated to the record is returned in the key parameter. 908<p> 909There is a minor behavioral difference between the Recno and Queue 910access methods this method. If a transaction enclosing this method 911aborts, the record number may be decremented (and later reallocated by 912a subsequent operation) in the Recno access method, but will not be 913decremented or reallocated in the Queue access method. 914<p> 915It may be useful to modify the stored data based on the generated key. 916If a callback function is specified using <A HREF="/com/sleepycat/db/DatabaseConfig.html#setRecordNumberAppender(com.sleepycat.db.RecordNumberAppender)"><CODE>DatabaseConfig.setRecordNumberAppender</CODE></A>, it will be called after the record number has 917been selected, but before the data has been stored. 918<p> 919<P> 920<DD><DL> 921<DT><B>Parameters:</B><DD><CODE>txn</CODE> - For a transactional database, an explicit transaction may be specified, or null 922may be specified to use auto-commit. For a non-transactional database, null 923must be specified. 924<p><DD><CODE>key</CODE> - the key <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db"><CODE>DatabaseEntry</CODE></A> operated on. 925<p><DD><CODE>data</CODE> - the data <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db"><CODE>DatabaseEntry</CODE></A> stored. 926<p> 927<p> 928<p> 929<DT><B>Throws:</B> 930<DD><CODE><A HREF="/com/sleepycat/db/DeadlockException.html" title="class in com.sleepycat.db">DeadlockException</A></CODE> - if the operation was selected to resolve a 931deadlock. 932<p> 933<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 934</DD> 935</DL> 936<HR> 937 938<A NAME="consume(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, boolean)"><!-- --></A><H3> 939consume</H3> 940<PRE> 941public <A HREF="/com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</A> <B>consume</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 942 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key, 943 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> data, 944 boolean wait) 945 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 946<DL> 947<DD>Return the record number and data from the available record closest to 948the head of the queue, and delete the record. The record number will be 949returned in the <code>key</code> parameter, and the data will be returned 950in the <code>data</code> parameter. A record is available if it is not 951deleted and is not currently locked. The underlying database must be 952of type Queue for this method to be called. 953<p> 954<P> 955<DD><DL> 956<DT><B>Parameters:</B><DD><CODE>txn</CODE> - For a transactional database, an explicit transaction may be specified to 957transaction-protect the operation, or null may be specified to perform the 958operation without transaction protection. For a non-transactional database, 959null must be specified.<DD><CODE>key</CODE> - the key 960returned as output. Its byte array does not need to be initialized by the 961caller.<DD><CODE>data</CODE> - the data 962returned as output. Its byte array does not need to be initialized by the 963caller.<DD><CODE>wait</CODE> - if there is no record available, this parameter determines whether the 964method waits for one to become available, or returns immediately with 965status <code>NOTFOUND</code>. 966<p> 967<DT><B>Returns:</B><DD><A HREF="/com/sleepycat/db/OperationStatus.html#NOTFOUND"><CODE>OperationStatus.NOTFOUND</CODE></A> if no matching key/data pair is 968found; <A HREF="/com/sleepycat/db/OperationStatus.html#KEYEMPTY"><CODE>OperationStatus.KEYEMPTY</CODE></A> if the database is a Queue or Recno database and the specified key exists, but was never explicitly created by the application or was later deleted; otherwise, <A HREF="/com/sleepycat/db/OperationStatus.html#SUCCESS"><CODE>OperationStatus.SUCCESS</CODE></A>. 969<p> 970<p> 971<DT><B>Throws:</B> 972<DD><CODE><A HREF="/com/sleepycat/db/DeadlockException.html" title="class in com.sleepycat.db">DeadlockException</A></CODE> - if the operation was selected to resolve a 973deadlock. 974<p> 975<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if an invalid parameter was specified. 976<p> 977<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 978</DD> 979</DL> 980<HR> 981 982<A NAME="delete(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry)"><!-- --></A><H3> 983delete</H3> 984<PRE> 985public <A HREF="/com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</A> <B>delete</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 986 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key) 987 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 988<DL> 989<DD>Remove key/data pairs from the database. 990 <p> 991 The key/data pair associated with the specified key is discarded 992 from the database. In the presence of duplicate key values, all 993 records associated with the designated key will be discarded. 994 <p> 995 The key/data pair is also deleted from any associated secondary 996 databases. 997 <p> 998<P> 999<DD><DL> 1000<DT><B>Parameters:</B><DD><CODE>txn</CODE> - For a transactional database, an explicit transaction may be specified, or null 1001may be specified to use auto-commit. For a non-transactional database, null 1002must be specified. 1003 <p><DD><CODE>key</CODE> - the key <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db"><CODE>DatabaseEntry</CODE></A> operated on. 1004 <p> 1005<DT><B>Returns:</B><DD>The method will return <A HREF="/com/sleepycat/db/OperationStatus.html#NOTFOUND"><CODE>OperationStatus.NOTFOUND</CODE></A> if the 1006 specified key is not found in the database; 1007 The method will return <A HREF="/com/sleepycat/db/OperationStatus.html#KEYEMPTY"><CODE>OperationStatus.KEYEMPTY</CODE></A> if the 1008 database is a Queue or Recno database and the specified key exists, 1009 but was never explicitly created by the application or was later 1010 deleted; 1011 otherwise the method will return <A HREF="/com/sleepycat/db/OperationStatus.html#SUCCESS"><CODE>OperationStatus.SUCCESS</CODE></A>. 1012 <p> 1013 <p> 1014<DT><B>Throws:</B> 1015<DD><CODE><A HREF="/com/sleepycat/db/DeadlockException.html" title="class in com.sleepycat.db">DeadlockException</A></CODE> - if the operation was selected to resolve a 1016deadlock. 1017<p> 1018<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 1019</DD> 1020</DL> 1021<HR> 1022 1023<A NAME="exists(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry)"><!-- --></A><H3> 1024exists</H3> 1025<PRE> 1026public <A HREF="/com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</A> <B>exists</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 1027 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key) 1028 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 1029<DL> 1030<DD>Checks if the specified key appears in the database. 1031<p> 1032<P> 1033<DD><DL> 1034<DT><B>Parameters:</B><DD><CODE>txn</CODE> - For a transactional database, an explicit transaction may be specified to 1035transaction-protect the operation, or null may be specified to perform the 1036operation without transaction protection. For a non-transactional database, 1037null must be specified. 1038<p><DD><CODE>key</CODE> - the key 1039used as input. It must be initialized with a non-null byte array by the 1040caller. 1041<p> 1042<DT><B>Returns:</B><DD><A HREF="/com/sleepycat/db/OperationStatus.html#NOTFOUND"><CODE>OperationStatus.NOTFOUND</CODE></A> if no matching key/data pair is 1043found; <A HREF="/com/sleepycat/db/OperationStatus.html#KEYEMPTY"><CODE>OperationStatus.KEYEMPTY</CODE></A> if the database is a Queue or Recno database and the specified key exists, but was never explicitly created by the application or was later deleted; otherwise, <A HREF="/com/sleepycat/db/OperationStatus.html#SUCCESS"><CODE>OperationStatus.SUCCESS</CODE></A>. 1044<p> 1045<p> 1046<DT><B>Throws:</B> 1047<DD><CODE><A HREF="/com/sleepycat/db/DeadlockException.html" title="class in com.sleepycat.db">DeadlockException</A></CODE> - if the operation was selected to resolve a 1048deadlock. 1049<p> 1050<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if an invalid parameter was specified. 1051<p> 1052<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 1053</DD> 1054</DL> 1055<HR> 1056 1057<A NAME="get(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.LockMode)"><!-- --></A><H3> 1058get</H3> 1059<PRE> 1060public <A HREF="/com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</A> <B>get</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 1061 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key, 1062 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> data, 1063 <A HREF="/com/sleepycat/db/LockMode.html" title="class in com.sleepycat.db">LockMode</A> lockMode) 1064 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 1065<DL> 1066<DD>Retrieves the key/data pair with the given key. If the matching key has 1067duplicate values, the first data item in the set of duplicates is returned. 1068Retrieval of duplicates requires the use of <A HREF="/com/sleepycat/db/Cursor.html" title="class in com.sleepycat.db"><CODE>Cursor</CODE></A> operations. 1069<p> 1070<P> 1071<DD><DL> 1072<DT><B>Parameters:</B><DD><CODE>txn</CODE> - For a transactional database, an explicit transaction may be specified to 1073transaction-protect the operation, or null may be specified to perform the 1074operation without transaction protection. For a non-transactional database, 1075null must be specified. 1076<p><DD><CODE>key</CODE> - the key 1077used as input. It must be initialized with a non-null byte array by the 1078caller. 1079<p> 1080<p><DD><CODE>data</CODE> - the data 1081returned as output. Its byte array does not need to be initialized by the 1082caller. 1083<p><DD><CODE>lockMode</CODE> - the locking attributes; if null, default attributes are used. 1084<p> 1085<DT><B>Returns:</B><DD><A HREF="/com/sleepycat/db/OperationStatus.html#NOTFOUND"><CODE>OperationStatus.NOTFOUND</CODE></A> if no matching key/data pair is 1086found; <A HREF="/com/sleepycat/db/OperationStatus.html#KEYEMPTY"><CODE>OperationStatus.KEYEMPTY</CODE></A> if the database is a Queue or Recno database and the specified key exists, but was never explicitly created by the application or was later deleted; otherwise, <A HREF="/com/sleepycat/db/OperationStatus.html#SUCCESS"><CODE>OperationStatus.SUCCESS</CODE></A>. 1087<p> 1088<p> 1089<DT><B>Throws:</B> 1090<DD><CODE><A HREF="/com/sleepycat/db/DeadlockException.html" title="class in com.sleepycat.db">DeadlockException</A></CODE> - if the operation was selected to resolve a 1091deadlock. 1092<p> 1093<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if an invalid parameter was specified. 1094<p> 1095<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 1096</DD> 1097</DL> 1098<HR> 1099 1100<A NAME="getKeyRange(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry)"><!-- --></A><H3> 1101getKeyRange</H3> 1102<PRE> 1103public <A HREF="/com/sleepycat/db/KeyRange.html" title="class in com.sleepycat.db">KeyRange</A> <B>getKeyRange</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 1104 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key) 1105 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 1106<DL> 1107<DD>Return an estimate of the proportion of keys in the database less 1108 than, equal to, and greater than the specified key. 1109 <p> 1110 The underlying database must be of type Btree. 1111 <p> 1112 This method does not retain the locks it acquires for the life of 1113 the transaction, so estimates are not repeatable. 1114 <p> 1115<P> 1116<DD><DL> 1117<DT><B>Parameters:</B><DD><CODE>key</CODE> - The key <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db"><CODE>DatabaseEntry</CODE></A> being compared. 1118 <p><DD><CODE>txn</CODE> - For a transactional database, an explicit transaction may be specified to 1119transaction-protect the operation, or null may be specified to perform the 1120operation without transaction protection. For a non-transactional database, 1121null must be specified. 1122 <p> 1123<DT><B>Returns:</B><DD>An estimate of the proportion of keys in the database less than, 1124 equal to, and greater than the specified key. 1125 <p> 1126 <p> 1127<DT><B>Throws:</B> 1128<DD><CODE><A HREF="/com/sleepycat/db/DeadlockException.html" title="class in com.sleepycat.db">DeadlockException</A></CODE> - if the operation was selected to resolve a 1129deadlock. 1130<p> 1131<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 1132</DD> 1133</DL> 1134<HR> 1135 1136<A NAME="getSearchBoth(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.LockMode)"><!-- --></A><H3> 1137getSearchBoth</H3> 1138<PRE> 1139public <A HREF="/com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</A> <B>getSearchBoth</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 1140 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key, 1141 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> data, 1142 <A HREF="/com/sleepycat/db/LockMode.html" title="class in com.sleepycat.db">LockMode</A> lockMode) 1143 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 1144<DL> 1145<DD>Retrieves the key/data pair with the given key and data value, that is, both 1146the key and data items must match. 1147<p> 1148<P> 1149<DD><DL> 1150<DT><B>Parameters:</B><DD><CODE>txn</CODE> - For a transactional database, an explicit transaction may be specified to 1151transaction-protect the operation, or null may be specified to perform the 1152operation without transaction protection. For a non-transactional database, 1153null must be specified.<DD><CODE>key</CODE> - the key 1154used as input. It must be initialized with a non-null byte array by the 1155caller.<DD><CODE>data</CODE> - the data 1156used as input. It must be initialized with a non-null byte array by the 1157caller. 1158<p><DD><CODE>lockMode</CODE> - the locking attributes; if null, default attributes are used. 1159<p> 1160<DT><B>Returns:</B><DD><A HREF="/com/sleepycat/db/OperationStatus.html#NOTFOUND"><CODE>OperationStatus.NOTFOUND</CODE></A> if no matching key/data pair is 1161found; <A HREF="/com/sleepycat/db/OperationStatus.html#KEYEMPTY"><CODE>OperationStatus.KEYEMPTY</CODE></A> if the database is a Queue or Recno database and the specified key exists, but was never explicitly created by the application or was later deleted; otherwise, <A HREF="/com/sleepycat/db/OperationStatus.html#SUCCESS"><CODE>OperationStatus.SUCCESS</CODE></A>. 1162<p> 1163<p> 1164<DT><B>Throws:</B> 1165<DD><CODE><A HREF="/com/sleepycat/db/DeadlockException.html" title="class in com.sleepycat.db">DeadlockException</A></CODE> - if the operation was selected to resolve a 1166deadlock. 1167<p> 1168<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if an invalid parameter was specified. 1169<p> 1170<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 1171</DD> 1172</DL> 1173<HR> 1174 1175<A NAME="getSearchRecordNumber(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.LockMode)"><!-- --></A><H3> 1176getSearchRecordNumber</H3> 1177<PRE> 1178public <A HREF="/com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</A> <B>getSearchRecordNumber</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 1179 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key, 1180 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> data, 1181 <A HREF="/com/sleepycat/db/LockMode.html" title="class in com.sleepycat.db">LockMode</A> lockMode) 1182 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 1183<DL> 1184<DD>Retrieves the key/data pair associated with the specific numbered record of the database. 1185<p> 1186The data field of the specified key must be a byte array containing a 1187record number, as described in <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db"><CODE>DatabaseEntry</CODE></A>. This determines 1188the record to be retrieved. 1189<p> 1190For this method to be called, the underlying database must be of type 1191Btree, and it must have been configured to support record numbers. 1192<p> 1193If this method fails for any reason, the position of the cursor will be 1194unchanged. 1195<P> 1196<DD><DL> 1197<DT><B>Parameters:</B><DD><CODE>key</CODE> - the key 1198returned as output. Its byte array does not need to be initialized by the 1199caller.<DD><CODE>data</CODE> - the data 1200returned as output. Multiple results can be retrieved by passing an object 1201that is a subclass of <A HREF="/com/sleepycat/db/MultipleEntry.html" title="class in com.sleepycat.db"><CODE>MultipleEntry</CODE></A>, otherwise its byte array does not 1202need to be initialized by the caller.<DD><CODE>lockMode</CODE> - the locking attributes; if null, default attributes are used. 1203<DT><B>Returns:</B><DD><A HREF="/com/sleepycat/db/OperationStatus.html#NOTFOUND"><CODE>OperationStatus.NOTFOUND</CODE></A> if no matching key/data pair is 1204found; <A HREF="/com/sleepycat/db/OperationStatus.html#KEYEMPTY"><CODE>OperationStatus.KEYEMPTY</CODE></A> if the database is a Queue or Recno database and the specified key exists, but was never explicitly created by the application or was later deleted; otherwise, <A HREF="/com/sleepycat/db/OperationStatus.html#SUCCESS"><CODE>OperationStatus.SUCCESS</CODE></A>. 1205<DT><B>Throws:</B> 1206<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/NullPointerException.html" title="class or interface in java.lang">NullPointerException</A></CODE> - if a DatabaseEntry parameter is null or 1207does not contain a required non-null byte array. 1208<p> 1209<DD><CODE><A HREF="/com/sleepycat/db/DeadlockException.html" title="class in com.sleepycat.db">DeadlockException</A></CODE> - if the operation was selected to resolve a 1210deadlock. 1211<p> 1212<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if an invalid parameter was specified. 1213<p> 1214<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs. 1215<p></DL> 1216</DD> 1217</DL> 1218<HR> 1219 1220<A NAME="put(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry)"><!-- --></A><H3> 1221put</H3> 1222<PRE> 1223public <A HREF="/com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</A> <B>put</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 1224 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key, 1225 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> data) 1226 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 1227<DL> 1228<DD><p> 1229Store the key/data pair into the database. 1230<p> 1231If the key already appears in the database and duplicates are not 1232configured, the existing key/data pair will be replaced. If the key 1233already appears in the database and sorted duplicates are configured, 1234the new data value is inserted at the correct sorted location. 1235If the key already appears in the database and unsorted duplicates are 1236configured, the new data value is appended at the end of the duplicate 1237set. 1238<p> 1239<P> 1240<DD><DL> 1241<DT><B>Parameters:</B><DD><CODE>txn</CODE> - For a transactional database, an explicit transaction may be specified, or null 1242may be specified to use auto-commit. For a non-transactional database, null 1243must be specified. 1244<p><DD><CODE>key</CODE> - the key <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db"><CODE>DatabaseEntry</CODE></A> operated on. 1245<p><DD><CODE>data</CODE> - the data <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db"><CODE>DatabaseEntry</CODE></A> stored. 1246<p> 1247<p> 1248<p> 1249<DT><B>Throws:</B> 1250<DD><CODE><A HREF="/com/sleepycat/db/DeadlockException.html" title="class in com.sleepycat.db">DeadlockException</A></CODE> - if the operation was selected to resolve a 1251deadlock. 1252<p> 1253<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 1254</DD> 1255</DL> 1256<HR> 1257 1258<A NAME="putNoDupData(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry)"><!-- --></A><H3> 1259putNoDupData</H3> 1260<PRE> 1261public <A HREF="/com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</A> <B>putNoDupData</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 1262 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key, 1263 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> data) 1264 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 1265<DL> 1266<DD><p> 1267Store the key/data pair into the database if it does not already appear 1268in the database. 1269<p> 1270This method may only be called if the underlying database has been 1271configured to support sorted duplicates. 1272(This method may not be specified to the Queue or Recno access methods.) 1273<p> 1274<P> 1275<DD><DL> 1276<DT><B>Parameters:</B><DD><CODE>txn</CODE> - For a transactional database, an explicit transaction may be specified, or null 1277may be specified to use auto-commit. For a non-transactional database, null 1278must be specified. 1279<p><DD><CODE>key</CODE> - the key <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db"><CODE>DatabaseEntry</CODE></A> operated on. 1280<p><DD><CODE>data</CODE> - the data <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db"><CODE>DatabaseEntry</CODE></A> stored. 1281<p> 1282<DT><B>Returns:</B><DD>If the key/data pair already appears in the database, this method will 1283return <A HREF="/com/sleepycat/db/OperationStatus.html#KEYEXIST"><CODE>OperationStatus.KEYEXIST</CODE></A>. 1284<p> 1285<p> 1286<DT><B>Throws:</B> 1287<DD><CODE><A HREF="/com/sleepycat/db/DeadlockException.html" title="class in com.sleepycat.db">DeadlockException</A></CODE> - if the operation was selected to resolve a 1288deadlock. 1289<p> 1290<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 1291</DD> 1292</DL> 1293<HR> 1294 1295<A NAME="putNoOverwrite(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry)"><!-- --></A><H3> 1296putNoOverwrite</H3> 1297<PRE> 1298public <A HREF="/com/sleepycat/db/OperationStatus.html" title="class in com.sleepycat.db">OperationStatus</A> <B>putNoOverwrite</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 1299 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> key, 1300 <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db">DatabaseEntry</A> data) 1301 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 1302<DL> 1303<DD><p> 1304Store the key/data pair into the database if the key does not already 1305appear in the database. 1306<p> 1307This method will fail if the key already exists in the database, even 1308if the database supports duplicates. 1309<p> 1310<P> 1311<DD><DL> 1312<DT><B>Parameters:</B><DD><CODE>txn</CODE> - For a transactional database, an explicit transaction may be specified, or null 1313may be specified to use auto-commit. For a non-transactional database, null 1314must be specified. 1315<p><DD><CODE>key</CODE> - the key <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db"><CODE>DatabaseEntry</CODE></A> operated on. 1316<p><DD><CODE>data</CODE> - the data <A HREF="/com/sleepycat/db/DatabaseEntry.html" title="class in com.sleepycat.db"><CODE>DatabaseEntry</CODE></A> stored. 1317<p> 1318<DT><B>Returns:</B><DD>If the key already appears in the database, this method will return 1319<A HREF="/com/sleepycat/db/OperationStatus.html#KEYEXIST"><CODE>OperationStatus.KEYEXIST</CODE></A>. 1320<p> 1321<p> 1322<DT><B>Throws:</B> 1323<DD><CODE><A HREF="/com/sleepycat/db/DeadlockException.html" title="class in com.sleepycat.db">DeadlockException</A></CODE> - if the operation was selected to resolve a 1324deadlock. 1325<p> 1326<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 1327</DD> 1328</DL> 1329<HR> 1330 1331<A NAME="join(com.sleepycat.db.Cursor[], com.sleepycat.db.JoinConfig)"><!-- --></A><H3> 1332join</H3> 1333<PRE> 1334public <A HREF="/com/sleepycat/db/JoinCursor.html" title="class in com.sleepycat.db">JoinCursor</A> <B>join</B>(<A HREF="/com/sleepycat/db/Cursor.html" title="class in com.sleepycat.db">Cursor</A>[] cursors, 1335 <A HREF="/com/sleepycat/db/JoinConfig.html" title="class in com.sleepycat.db">JoinConfig</A> config) 1336 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 1337<DL> 1338<DD>Creates a specialized join cursor for use in performing equality or 1339 natural joins on secondary indices. 1340 <p> 1341 Each cursor in the <code>cursors</code> array must have been 1342 initialized to refer to the key on which the underlying database should 1343 be joined. Typically, this initialization is done by calling 1344 <A HREF="/com/sleepycat/db/Cursor.html#getSearchKey(com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.LockMode)"><CODE>Cursor.getSearchKey</CODE></A>. 1345 <p> 1346 Once the cursors have been passed to this method, they should not be 1347 accessed or modified until the newly created join cursor has been 1348 closed, or else inconsistent results may be returned. However, the 1349 position of the cursors will not be changed by this method or by the 1350 methods of the join cursor. 1351 <p> 1352<P> 1353<DD><DL> 1354<DT><B>Parameters:</B><DD><CODE>cursors</CODE> - an array of cursors associated with this primary 1355 database. 1356 <p><DD><CODE>config</CODE> - The join attributes. If null, default attributes are used. 1357 <p> 1358<DT><B>Returns:</B><DD>a specialized cursor that returns the results of the equality join 1359 operation. 1360 <p> 1361<DT><B>Throws:</B> 1362<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs. 1363 <p><DT><B>See Also:</B><DD><A HREF="/com/sleepycat/db/JoinCursor.html" title="class in com.sleepycat.db"><CODE>JoinCursor</CODE></A></DL> 1364</DD> 1365</DL> 1366<HR> 1367 1368<A NAME="truncate(com.sleepycat.db.Transaction, boolean)"><!-- --></A><H3> 1369truncate</H3> 1370<PRE> 1371public int <B>truncate</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 1372 boolean countRecords) 1373 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 1374<DL> 1375<DD>Empty the database, discarding all records it contains. 1376 <p> 1377 When called on a database configured with secondary indices, this 1378 method truncates the primary database and all secondary indices. If 1379 configured to return a count of the records discarded, the returned 1380 count is the count of records discarded from the primary database. 1381 <p> 1382 It is an error to call this method on a database with open cursors. 1383 <p> 1384<P> 1385<DD><DL> 1386<DT><B>Parameters:</B><DD><CODE>txn</CODE> - For a transactional database, an explicit transaction may be specified, or 1387 null may be specified to use auto-commit. For a non-transactional 1388 database, null must be specified. 1389 <p><DD><CODE>countRecords</CODE> - If true, count and return the number of records discarded. 1390 <p> 1391<DT><B>Returns:</B><DD>The number of records discarded, or -1 if returnCount is false. 1392 <p> 1393<DT><B>Throws:</B> 1394<DD><CODE><A HREF="/com/sleepycat/db/DeadlockException.html" title="class in com.sleepycat.db">DeadlockException</A></CODE> - if the operation was selected to resolve a 1395 deadlock. 1396 <p> 1397<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 1398</DD> 1399</DL> 1400<HR> 1401 1402<A NAME="getStats(com.sleepycat.db.Transaction, com.sleepycat.db.StatsConfig)"><!-- --></A><H3> 1403getStats</H3> 1404<PRE> 1405public <A HREF="/com/sleepycat/db/DatabaseStats.html" title="class in com.sleepycat.db">DatabaseStats</A> <B>getStats</B>(<A HREF="/com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> txn, 1406 <A HREF="/com/sleepycat/db/StatsConfig.html" title="class in com.sleepycat.db">StatsConfig</A> config) 1407 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 1408<DL> 1409<DD>Return database statistics. 1410 <p> 1411 If this method has not been configured to avoid expensive operations 1412 (using the <A HREF="/com/sleepycat/db/StatsConfig.html#setFast(boolean)"><CODE>StatsConfig.setFast</CODE></A> method), it will access 1413 some of or all the pages in the database, incurring a severe 1414 performance penalty as well as possibly flushing the underlying 1415 buffer pool. 1416 <p> 1417 In the presence of multiple threads or processes accessing an active 1418 database, the information returned by this method may be out-of-date. 1419 <p> 1420 If the database was not opened read-only and this method was not 1421 configured using the <A HREF="/com/sleepycat/db/StatsConfig.html#setFast(boolean)"><CODE>StatsConfig.setFast</CODE></A> method, cached 1422 key and record numbers will be updated after the statistical 1423 information has been gathered. 1424 <p> 1425<P> 1426<DD><DL> 1427<DT><B>Parameters:</B><DD><CODE>txn</CODE> - For a transactional database, an explicit transaction may be specified to 1428 transaction-protect the operation, or null may be specified to perform the 1429 operation without transaction protection. For a non-transactional 1430 database, null must be specified. 1431 <p><DD><CODE>config</CODE> - The statistics returned; if null, default statistics are returned. 1432 <p> 1433<DT><B>Returns:</B><DD>Database statistics. 1434 <p> 1435<DT><B>Throws:</B> 1436<DD><CODE><A HREF="/com/sleepycat/db/DeadlockException.html" title="class in com.sleepycat.db">DeadlockException</A></CODE> - if the operation was selected to resolve a 1437 deadlock. 1438 <p> 1439<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 1440</DD> 1441</DL> 1442<HR> 1443 1444<A NAME="remove(java.lang.String, java.lang.String, com.sleepycat.db.DatabaseConfig)"><!-- --></A><H3> 1445remove</H3> 1446<PRE> 1447public static void <B>remove</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> fileName, 1448 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> databaseName, 1449 <A HREF="/com/sleepycat/db/DatabaseConfig.html" title="class in com.sleepycat.db">DatabaseConfig</A> config) 1450 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A>, 1451 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/io/FileNotFoundException.html" title="class or interface in java.io">FileNotFoundException</A></PRE> 1452<DL> 1453<DD><p> 1454Remove a database. 1455<p> 1456If no database is specified, the underlying file specified is removed. 1457<p> 1458Applications should never remove databases with open <A HREF="/com/sleepycat/db/Database.html" title="class in com.sleepycat.db"><CODE>Database</CODE></A> 1459handles, or in the case of removing a file, when any database in the 1460file has an open handle. For example, some architectures do not permit 1461the removal of files with open system handles. On these architectures, 1462attempts to remove databases currently in use by any thread of control 1463in the system may fail. 1464<p> 1465If the database was opened within a database environment, the 1466environment variable DB_HOME may be used as the path of the database 1467environment home. 1468<p> 1469This method is affected by any database directory specified with 1470<A HREF="/com/sleepycat/db/EnvironmentConfig.html#addDataDir(java.io.File)"><CODE>EnvironmentConfig.addDataDir</CODE></A>, or by setting the "set_data_dir" 1471string in the database environment's DB_CONFIG file. 1472<p> 1473The <A HREF="/com/sleepycat/db/Database.html" title="class in com.sleepycat.db"><CODE>Database</CODE></A> handle may not be accessed 1474again after this method is called, regardless of this method's success 1475or failure. 1476<p> 1477<P> 1478<DD><DL> 1479<DT><B>Parameters:</B><DD><CODE>fileName</CODE> - The physical file which contains the database to be removed. 1480On Windows platforms, this argument will be interpreted as a UTF-8 1481string, which is equivalent to ASCII for Latin characters. 1482<p><DD><CODE>databaseName</CODE> - The database to be removed. 1483<p><DD><CODE>config</CODE> - The database remove attributes. If null, default attributes are used. 1484<p> 1485<p> 1486<DT><B>Throws:</B> 1487<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs. 1488<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/io/FileNotFoundException.html" title="class or interface in java.io">FileNotFoundException</A></CODE></DL> 1489</DD> 1490</DL> 1491<HR> 1492 1493<A NAME="rename(java.lang.String, java.lang.String, java.lang.String, com.sleepycat.db.DatabaseConfig)"><!-- --></A><H3> 1494rename</H3> 1495<PRE> 1496public static void <B>rename</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> fileName, 1497 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> oldDatabaseName, 1498 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> newDatabaseName, 1499 <A HREF="/com/sleepycat/db/DatabaseConfig.html" title="class in com.sleepycat.db">DatabaseConfig</A> config) 1500 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A>, 1501 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/io/FileNotFoundException.html" title="class or interface in java.io">FileNotFoundException</A></PRE> 1502<DL> 1503<DD><p> 1504Rename a database. 1505<p> 1506If no database name is specified, the underlying file specified is 1507renamed, incidentally renaming all of the databases it contains. 1508<p> 1509Applications should never rename databases that are currently in use. 1510If an underlying file is being renamed and logging is currently enabled 1511in the database environment, no database in the file may be open when 1512this method is called. In particular, some architectures do not permit 1513renaming files with open handles. On these architectures, attempts to 1514rename databases that are currently in use by any thread of control in 1515the system may fail. 1516<p> 1517If the database was opened within a database environment, the 1518environment variable DB_HOME may be used as the path of the database 1519environment home. 1520<p> 1521This method is affected by any database directory specified with 1522<A HREF="/com/sleepycat/db/EnvironmentConfig.html#addDataDir(java.io.File)"><CODE>EnvironmentConfig.addDataDir</CODE></A>, or by setting the "set_data_dir" 1523string in the database environment's DB_CONFIG file. 1524<p> 1525The <A HREF="/com/sleepycat/db/Database.html" title="class in com.sleepycat.db"><CODE>Database</CODE></A> handle may not be accessed 1526again after this method is called, regardless of this method's success 1527or failure. 1528<p> 1529<P> 1530<DD><DL> 1531<DT><B>Parameters:</B><DD><CODE>fileName</CODE> - The physical file which contains the database to be renamed. 1532On Windows platforms, this argument will be interpreted as a UTF-8 1533string, which is equivalent to ASCII for Latin characters. 1534<p><DD><CODE>oldDatabaseName</CODE> - The database to be renamed. 1535<p><DD><CODE>newDatabaseName</CODE> - The new name of the database or file. 1536<p><DD><CODE>config</CODE> - The database rename attributes. If null, default attributes are used. 1537<p> 1538<p> 1539<DT><B>Throws:</B> 1540<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs. 1541<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/io/FileNotFoundException.html" title="class or interface in java.io">FileNotFoundException</A></CODE></DL> 1542</DD> 1543</DL> 1544<HR> 1545 1546<A NAME="sync()"><!-- --></A><H3> 1547sync</H3> 1548<PRE> 1549public void <B>sync</B>() 1550 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 1551<DL> 1552<DD>Flush any cached information to disk. 1553 <p> 1554 If the database is in memory only, this method has no effect and 1555 will always succeed. 1556 <p> 1557 <b>It is important to understand that flushing cached information to 1558 disk only minimizes the window of opportunity for corrupted data.</b> 1559 <p> 1560 Although unlikely, it is possible for database corruption to happen 1561 if a system or application crash occurs while writing data to the 1562 database. To ensure that database corruption never occurs, 1563 applications must either: use transactions and logging with 1564 automatic recovery; use logging and application-specific recovery; 1565 or edit a copy of the database, and once all applications using the 1566 database have successfully closed the copy of the database, 1567 atomically replace the original database with the updated copy. 1568 <p> 1569 <p> 1570<P> 1571<DD><DL> 1572 1573<DT><B>Throws:</B> 1574<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 1575</DD> 1576</DL> 1577<HR> 1578 1579<A NAME="upgrade(java.lang.String, com.sleepycat.db.DatabaseConfig)"><!-- --></A><H3> 1580upgrade</H3> 1581<PRE> 1582public static void <B>upgrade</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> fileName, 1583 <A HREF="/com/sleepycat/db/DatabaseConfig.html" title="class in com.sleepycat.db">DatabaseConfig</A> config) 1584 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A>, 1585 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/io/FileNotFoundException.html" title="class or interface in java.io">FileNotFoundException</A></PRE> 1586<DL> 1587<DD>Upgrade all of the databases included in the specified file. 1588 <p> 1589 If no upgrade is necessary, always returns success. 1590 <p> 1591 <b> 1592 Database upgrades are done in place and are destructive. For example, 1593 if pages need to be allocated and no disk space is available, the 1594 database may be left corrupted. Backups should be made before databases 1595 are upgraded. 1596 </b> 1597 <p> 1598 <b> 1599 The following information is only meaningful when upgrading databases 1600 from releases before the Berkeley DB 3.1 release: 1601 </b> 1602 <p> 1603 As part of the upgrade from the Berkeley DB 3.0 release to the 3.1 1604 release, the on-disk format of duplicate data items changed. To 1605 correctly upgrade the format requires applications to specify 1606 whether duplicate data items in the database are sorted or not. 1607 Configuring the database object to support sorted duplicates by the 1608 <A HREF="/com/sleepycat/db/DatabaseConfig.html#setSortedDuplicates(boolean)"><CODE>DatabaseConfig.setSortedDuplicates</CODE></A> method informs this 1609 method that the duplicates are sorted; otherwise they are assumed 1610 to be unsorted. Incorrectly specifying this configuration 1611 information may lead to database corruption. 1612 <p> 1613 Further, because this method upgrades a physical file (including all 1614 the databases it contains), it is not possible to use this method 1615 to upgrade files in which some of the databases it includes have 1616 sorted duplicate data items, and some of the databases it includes 1617 have unsorted duplicate data items. If the file does not have more 1618 than a single database, if the databases do not support duplicate 1619 data items, or if all of the databases that support duplicate data 1620 items support the same style of duplicates (either sorted or 1621 unsorted), this method will work correctly as long as the duplicate 1622 configuration is correctly specified. Otherwise, the file cannot 1623 be upgraded using this method; it must be upgraded manually by 1624 dumping and reloading the databases. 1625 <p> 1626 Unlike all other database operations, upgrades may only be done on 1627 a system with the same byte-order as the database. 1628 <p> 1629<P> 1630<DD><DL> 1631<DT><B>Parameters:</B><DD><CODE>fileName</CODE> - The physical file containing the databases to be upgraded. 1632 <p> 1633 <p> 1634<DT><B>Throws:</B> 1635<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs. 1636<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/io/FileNotFoundException.html" title="class or interface in java.io">FileNotFoundException</A></CODE></DL> 1637</DD> 1638</DL> 1639<HR> 1640 1641<A NAME="verify(java.lang.String, java.lang.String, java.io.PrintStream, com.sleepycat.db.VerifyConfig, com.sleepycat.db.DatabaseConfig)"><!-- --></A><H3> 1642verify</H3> 1643<PRE> 1644public static boolean <B>verify</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> fileName, 1645 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> databaseName, 1646 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/io/PrintStream.html" title="class or interface in java.io">PrintStream</A> dumpStream, 1647 <A HREF="/com/sleepycat/db/VerifyConfig.html" title="class in com.sleepycat.db">VerifyConfig</A> verifyConfig, 1648 <A HREF="/com/sleepycat/db/DatabaseConfig.html" title="class in com.sleepycat.db">DatabaseConfig</A> dbConfig) 1649 throws <A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A>, 1650 <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/io/FileNotFoundException.html" title="class or interface in java.io">FileNotFoundException</A></PRE> 1651<DL> 1652<DD>Return if all of the databases in a file are uncorrupted. 1653 <p> 1654 This method optionally outputs the databases' key/data pairs to a 1655 file stream. 1656 <p> 1657 <b> 1658 This method does not perform any locking, even in database 1659 environments are configured with a locking subsystem. As such, it 1660 should only be used on files that are not being modified by another 1661 thread of control. 1662 </b> 1663 <p> 1664 This method may not be called after the database is opened. 1665 <p> 1666 If the database was opened within a database environment, the 1667environment variable DB_HOME may be used as the path of the database 1668environment home. 1669<p> 1670This method is affected by any database directory specified with 1671<A HREF="/com/sleepycat/db/EnvironmentConfig.html#addDataDir(java.io.File)"><CODE>EnvironmentConfig.addDataDir</CODE></A>, or by setting the "set_data_dir" 1672string in the database environment's DB_CONFIG file. 1673 <p> 1674 The <A HREF="/com/sleepycat/db/Database.html" title="class in com.sleepycat.db"><CODE>Database</CODE></A> handle may not be accessed 1675again after this method is called, regardless of this method's success 1676or failure. 1677 <p> 1678<P> 1679<DD><DL> 1680<DT><B>Parameters:</B><DD><CODE>fileName</CODE> - The physical file in which the databases to be verified are found. 1681 <p><DD><CODE>databaseName</CODE> - The database in the file on which the database checks for btree and 1682 duplicate sort order and for hashing are to be performed. This 1683 parameter should be set to null except when the operation has been 1684 been configured by <A HREF="/com/sleepycat/db/VerifyConfig.html#setOrderCheckOnly(boolean)"><CODE>VerifyConfig.setOrderCheckOnly</CODE></A>. 1685 <p><DD><CODE>dumpStream</CODE> - An optional file stream to which the databases' key/data pairs are 1686 written. This parameter should be set to null except when the 1687 operation has been been configured by <A HREF="/com/sleepycat/db/VerifyConfig.html#setSalvage(boolean)"><CODE>VerifyConfig.setSalvage</CODE></A>. 1688 <p><DD><CODE>verifyConfig</CODE> - The verify operation attributes. If null, default attributes are used. 1689 <p><DD><CODE>dbConfig</CODE> - The database attributes. If null, default attributes are used. 1690 <p> 1691<DT><B>Returns:</B><DD>True, if all of the databases in the file are uncorrupted. If this 1692 method returns false, and the operation was configured by 1693 <A HREF="/com/sleepycat/db/VerifyConfig.html#setSalvage(boolean)"><CODE>VerifyConfig.setSalvage</CODE></A>, all of the key/data pairs in the 1694 file may not have been successfully output. 1695 <p> 1696 <p> 1697<DT><B>Throws:</B> 1698<DD><CODE><A HREF="/com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs. 1699<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/io/FileNotFoundException.html" title="class or interface in java.io">FileNotFoundException</A></CODE></DL> 1700</DD> 1701</DL> 1702<!-- ========= END OF CLASS DATA ========= --> 1703<HR> 1704 1705 1706<!-- ======= START OF BOTTOM NAVBAR ====== --> 1707<A NAME="navbar_bottom"><!-- --></A> 1708<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> 1709<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 1710<TR> 1711<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 1712<A NAME="navbar_bottom_firstrow"><!-- --></A> 1713<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 1714 <TR ALIGN="center" VALIGN="top"> 1715 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 1716 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 1717 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 1718 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Database.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 1719 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 1720 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 1721 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 1722 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="/help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 1723 </TR> 1724</TABLE> 1725</TD> 1726<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 1727<b>Berkeley DB</b><br><font size="-1"> version 4.7.25</font></EM> 1728</TD> 1729</TR> 1730 1731<TR> 1732<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 1733 <A HREF="/com/sleepycat/db/CursorConfig.html" title="class in com.sleepycat.db"><B>PREV CLASS</B></A> 1734 <A HREF="/com/sleepycat/db/DatabaseConfig.html" title="class in com.sleepycat.db"><B>NEXT CLASS</B></A></FONT></TD> 1735<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 1736 <A HREF="/index.html?com/sleepycat/db/Database.html" target="_top"><B>FRAMES</B></A> 1737 <A HREF="Database.html" target="_top"><B>NO FRAMES</B></A> 1738 <SCRIPT type="text/javascript"> 1739 <!-- 1740 if(window==top) { 1741 document.writeln('<A HREF="/allclasses-noframe.html"><B>All Classes</B></A>'); 1742 } 1743 //--> 1744</SCRIPT> 1745<NOSCRIPT> 1746 <A HREF="/allclasses-noframe.html"><B>All Classes</B></A> 1747</NOSCRIPT> 1748 1749 1750</FONT></TD> 1751</TR> 1752<TR> 1753<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 1754 SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> 1755<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 1756DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> 1757</TR> 1758</TABLE> 1759<A NAME="skip-navbar_bottom"></A> 1760<!-- ======== END OF BOTTOM NAVBAR ======= --> 1761 1762<HR> 1763<font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 1764</BODY> 1765</HTML> 1766