Berkeley DB version 5.3.15

## com.sleepycat.db
Class DatabaseConfig

    java.lang.Object
      com.sleepycat.db.DatabaseConfig

All Implemented Interfaces:
  Cloneable

Direct Known Subclasses:
  SecondaryConfig

    public class DatabaseConfig

extends Object
implements Cloneable

Specify the attributes of a database.

Field Summary
`static DatabaseConfig` `DEFAULT` An instance created using the default constructor is initialized with the system's default settings.

Constructor Summary
`DatabaseConfig()` An instance created using the default constructor is initialized with the system's default settings.

Method Summary
`DatabaseConfig` `cloneConfig()` Returns a copy of this configuration object.
`boolean` `getAllowCreate()` Return true if the `Environment.openDatabase` method is configured to create the database if it does not already exist.
`Comparator` `getBtreeComparator()` Return the custom Comparator used for btree keys.
`BtreeCompressor` `getBtreeCompressor()` Get the Btree compression callbacks.
`int` `getBtreeMinKey()` Return the minimum number of key/data pairs intended to be stored on any single Btree leaf page.
`BtreePrefixCalculator` `getBtreePrefixCalculator()` Return the Btree prefix callback.
`boolean` `getBtreeRecordNumbers()` Return true if the Btree is configured to support retrieval by record number.
`int` `getByteOrder()` Return the database byte order; a byte order of 4,321 indicates a big endian order, and a byte order of 1,234 indicates a little endian order.
`boolean` `getByteSwapped()` Return if the underlying database files were created on an architecture of the same byte order as the current one.
`int` `getCacheCount()` Return the number of shared memory buffer pools, that is, the number of caches.
`long` `getCacheSize()` Return the size of the shared memory buffer pool, that is, the cache.
`boolean` `getChecksum()` Return true if the database environment is configured to do checksum verification of pages read into the cache from the backing filestore.
`File` `getCreateDir()` Return the directory a database will/has been created in or looked for.
`boolean` `getDirtyRead()` Deprecated. This has been replaced by `getReadUncommitted()` to conform to ANSI database isolation terminology.
`Comparator` `getDuplicateComparator()` Return the duplicate data item comparison callback.
`boolean` `getEncrypted()` Return true if the database has been configured to perform encryption.
`ErrorHandler` `getErrorHandler()` Return the function to be called if an error occurs.
`String` `getErrorPrefix()` Return the prefix string that appears before error messages.
`OutputStream` `getErrorStream()` Return the an OutputStream for displaying error messages.
`boolean` `getExclusiveCreate()` Return true if the `Environment.openDatabase` method is configured to fail if the database already exists.
`FeedbackHandler` `getFeedbackHandler()` Return the object's methods to be called to provide feedback.
`Comparator` `getHashComparator()` Return the Comparator used to compare keys in a Hash database.
`Hasher` `getHasher()` Return the database-specific hash function.
`int` `getHashFillFactor()` Return the hash table density.
`int` `getHashNumElements()` Return the estimate of the final size of the hash table.
`long` `getHeapRegionSize()` Return the number of pages in a region of the database.
`long` `getHeapsize()` Return the maximum on-disk database file size.
`MessageHandler` `getMessageHandler()` Return the function to be called with an informational message.
`OutputStream` `getMessageStream()` Return the an OutputStream for displaying informational messages.
`long` `getMode()` Return the mode used to create files.
`boolean` `getMultiversion()` Return true if the database is configured for multiversion concurrency control.
`boolean` `getNoMMap()` Return true if the library is configured to not map this database into memory.
`Boolean` `getNoWaitDbExclusiveLock()` Return whether the `Database` handle is configured to obtain a write lock on the entire database.
`int` `getPageSize()` Return the size of the pages used to hold items in the database, in bytes.
`PanicHandler` `getPanicHandler()` Return the function to be called if the database environment panics.
`File[]` `getPartitionDirs()` Return the array of directories the database extents should be created in or looked for.
`PartitionHandler` `getPartitionHandler()` Return the function to be called to determine which partition a key resides in.
`DatabaseEntry` `getPartitionKeys()` Return the array of keys the database is configured to partition with.
`int` `getPartitionParts()` Return the number of partitions the database is configured for.
`CacheFilePriority` `getPriority()` Return the the cache priority for pages referenced by this handle.
`int` `getQueueExtentSize()` Return the size of the extents used to hold pages in a Queue database, specified as a number of pages.
`boolean` `getQueueInOrder()` Return true if the `Database.consume` method is configured to return key/data pairs in order, always returning the key/data item from the head of the queue.
`boolean` `getReadOnly()` Return true if the database is configured in read-only mode.
`boolean` `getReadUncommitted()` Return true if the database is configured to support read uncommitted.
`int` `getRecordDelimiter()` Return the delimiting byte used to mark the end of a record in the backing source file for the Recno access method.
`int` `getRecordLength()` Return the database record length, in bytes.
`RecordNumberAppender` `getRecordNumberAppender()` Return the function to call after the record number has been selected but before the data has been stored into the database.
`int` `getRecordPad()` Return the padding character for short, fixed-length records for the Queue and Recno access methods.
`File` `getRecordSource()` Return the name of an underlying flat text database file that is read to initialize a transient record number index.
`boolean` `getRenumbering()` Return true if the logical record numbers are mutable, and change as records are added to and deleted from the database.
`boolean` `getReverseSplitOff()` Return true if the Btree has been configured to not do reverse splits.
`boolean` `getSnapshot()` Return true if the any specified backing source file will be read in its entirety when the database is opened.
`boolean` `getSortedDuplicates()` Return true if the database is configured to support sorted duplicate data items.
`boolean` `getTransactional()` Return true if the database open is enclosed within a transaction.
`boolean` `getTransactionNotDurable()` Return true if the database environment is configured to not write log records for this database.
`boolean` `getTruncate()` Return true if the database has been configured to be physically truncated by truncating the underlying file, discarding all previous databases it might have held.
`DatabaseType` `getType()` Return the type of the database.
`boolean` `getUnsortedDuplicates()` Return true if the database is configured to support duplicate data items.
`void` `setAllowCreate(boolean allowCreate)` Configure the `Environment.openDatabase` method to create the database if it does not already exist.
`void` `setBtreeComparator(Comparator btreeComparator)` By default, a byte by byte lexicographic comparison is used for btree keys.
`void` `setBtreeCompressor(BtreeCompressor btreeCompressor)` Set the Btree compression callbacks.
`void` `setBtreeMinKey(int btMinKey)` Set the minimum number of key/data pairs intended to be stored on any single Btree leaf page.
`void` `setBtreePrefixCalculator(BtreePrefixCalculator btreePrefixCalculator)` Set the Btree prefix callback.
`void` `setBtreeRecordNumbers(boolean btreeRecordNumbers)` Configure the Btree to support retrieval by record number.
`void` `setByteOrder(int byteOrder)` Set the byte order for integers in the stored database metadata.
`void` `setCacheCount(int cacheCount)` Set the number of shared memory buffer pools, that is, the number of caches.
`void` `setCacheSize(long cacheSize)` Set the size of the shared memory buffer pool, that is, the size of the cache.
`void` `setChecksum(boolean checksum)` Configure the database environment to do checksum verification of pages read into the cache from the backing filestore.
`void` `setCreateDir(File createDir)` Specify which directory a database should be created in or looked for.
`void` `setDirtyRead(boolean dirtyRead)` Deprecated. This has been replaced by `setReadUncommitted(boolean)` to conform to ANSI database isolation terminology.
`void` `setDuplicateComparator(Comparator duplicateComparator)` Set the duplicate data item comparison callback.
`void` `setEncrypted(String password)` Set the password used to perform encryption and decryption.
`void` `setErrorHandler(ErrorHandler errorHandler)` Set the function to be called if an error occurs.
`void` `setErrorPrefix(String errorPrefix)` Set the prefix string that appears before error messages.
`void` `setErrorStream(OutputStream errorStream)` Set an OutputStream for displaying error messages.
`void` `setExclusiveCreate(boolean exclusiveCreate)` Configure the `Environment.openDatabase` method to fail if the database already exists.
`void` `setFeedbackHandler(FeedbackHandler feedbackHandler)` Set an object whose methods are called to provide feedback.
`void` `setHashComparator(Comparator hashComparator)` Set the Hash key comparison function.
`void` `setHasher(Hasher hasher)` Set a database-specific hash function.
`void` `setHashFillFactor(int hashFillFactor)` Set the desired density within the hash table.
`void` `setHashNumElements(int hashNumElements)` Set an estimate of the final size of the hash table.
`void` `setHeapRegionSize(int npages)` Sets the number of pages in a region of a database configured to use the Heap access method.
`void` `setHeapsize(long bytes)` Set the maximum on-disk database file size used by a database configured to use the Heap access method.
`void` `setMessageHandler(MessageHandler messageHandler)` Set a function to be called with an informational message.
`void` `setMessageStream(OutputStream messageStream)` Set an OutputStream for displaying informational messages.
`void` `setMode(int mode)` On UNIX systems or in IEEE/ANSI Std 1003.1 (POSIX) environments, files created by the database open are created with mode `mode` (as described in the `chmod`(2) manual page) and modified by the process' umask value at the time of creation (see the `umask`(2) manual page).
`void` `setMultiversion(boolean multiversion)` Configured the database with support for multiversion concurrency control.
`void` `setNoMMap(boolean noMMap)` Configure the library to not map this database into memory.
`void` `setNoWaitDbExclusiveLock(Boolean noWaitDbExclLock)` Configure the `Database` handle to obtain a write lock on the entire database.
`void` `setPageSize(int pageSize)` Set the size of the pages used to hold items in the database, in bytes.
`void` `setPanicHandler(PanicHandler panicHandler)` Set the function to be called if the database environment panics.
`void` `setPartitionByCallback(int parts, PartitionHandler partitionHandler)` Enable or disable database partitioning, and set the callback that will be used for the partitioning.
`void` `setPartitionByRange(int parts, MultipleDataEntry keys)` Enable or disable database partitioning, and set key ranges that will be used for the partitioning.
`void` `setPartitionDirs(File[] dirs)` Specify the array of directories the database extents should be created in or looked for.
`void` `setPriority(CacheFilePriority priority)` Set the cache priority for pages referenced by the DB handle.
`void` `setQueueExtentSize(int queueExtentSize)` Set the size of the extents used to hold pages in a Queue database, specified as a number of pages.
`void` `setQueueInOrder(boolean queueInOrder)` Configure `Database.consume` to return key/data pairs in order, always returning the key/data item from the head of the queue.
`void` `setReadOnly(boolean readOnly)` Configure the database in read-only mode.
`void` `setReadUncommitted(boolean readUncommitted)` Configure the database to support read uncommitted.
`void` `setRecordDelimiter(int recordDelimiter)` Set the delimiting byte used to mark the end of a record in the backing source file for the Recno access method.
`void` `setRecordLength(int recordLength)` Specify the database record length, in bytes.
`void` `setRecordNumberAppender(RecordNumberAppender recnoAppender)` Configure `Database.append` to call the function after the record number has been selected but before the data has been stored into the database.
`void` `setRecordPad(int recordPad)` Set the padding character for short, fixed-length records for the Queue and Recno access methods.
`void` `setRecordSource(File recordSource)` Set the underlying source file for the Recno access method.
`void` `setRenumbering(boolean renumbering)` Configure the logical record numbers to be mutable, and change as records are added to and deleted from the database.
`void` `setReverseSplitOff(boolean reverseSplitOff)` Configure the Btree to not do reverse splits.
`void` `setSnapshot(boolean snapshot)` Specify that any specified backing source file be read in its entirety when the database is opened.
`void` `setSortedDuplicates(boolean sortedDuplicates)` Configure the database to support sorted, duplicate data items.
`void` `setTransactional(boolean transactional)` Enclose the database open within a transaction.
`void` `setTransactionNotDurable(boolean transactionNotDurable)` Configure the database environment to not write log records for this database.
`void` `setTruncate(boolean truncate)` Configure the database to be physically truncated by truncating the underlying file, discarding all previous databases it might have held.
`void` `setType(DatabaseType type)` Configure the type of the database.
`void` `setUnsortedDuplicates(boolean unsortedDuplicates)` Configure the database to support unsorted duplicate data items.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT

    public static final DatabaseConfig DEFAULT

  An instance created using the default constructor is initialized with the system's default settings.

Constructor Detail

### DatabaseConfig

    public DatabaseConfig()

  An instance created using the default constructor is initialized with the system's default settings.

Method Detail

### cloneConfig

    public DatabaseConfig cloneConfig()

  Returns a copy of this configuration object.

### setAllowCreate

    public void setAllowCreate(boolean allowCreate)

  Configure the `Environment.openDatabase` method to create the database if it does not already exist.

  Parameters:
    `allowCreate` - If true, configure the `Environment.openDatabase` method to create the database if it does not already exist.

### getAllowCreate

    public boolean getAllowCreate()

  Return true if the `Environment.openDatabase` method is configured to create the database if it does not already exist.

  This method may be called at any time during the life of the application.

  Returns:
    True if the `Environment.openDatabase` method is configured to create the database if it does not already exist.

### setBtreeComparator

    public void setBtreeComparator(Comparator btreeComparator)

  By default, a byte by byte lexicographic comparison is used for btree keys. To customize the comparison, supply a different Comparator.

  The `compare` method is passed the byte arrays representing keys that are stored in the database. If you know how your data is organized in the byte array, then you can write a comparison routine that directly examines the contents of the arrays. Otherwise, you have to reconstruct your original objects, and then perform the comparison.

### getBtreeComparator

    public Comparator getBtreeComparator()

  Return the custom Comparator used for btree keys.

  Returns:
    the custom Comparator used for btree keys, or null if the default comparison function will be used.

### setBtreeMinKey

    public void setBtreeMinKey(int btMinKey)

  Set the minimum number of key/data pairs intended to be stored on any single Btree leaf page.

  This value is used to determine if key or data items will be stored on overflow pages instead of Btree leaf pages. The value must be at least 2; if the value is not explicitly set, a value of 2 is used.

  This method configures a database, not only operations performed using the specified `Database` handle.

  This method may not be called after the database is opened. If the database already exists when it is opened, the information specified to this method will be ignored.

  Parameters:
    `btMinKey` - The minimum number of key/data pairs intended to be stored on any single Btree leaf page.

### getBtreeMinKey

    public int getBtreeMinKey()

  Return the minimum number of key/data pairs intended to be stored on any single Btree leaf page.

  This method may be called at any time during the life of the application.

  Returns:
    The minimum number of key/data pairs intended to be stored on any single Btree leaf page.

### setByteOrder

    public void setByteOrder(int byteOrder)

  Set the byte order for integers in the stored database metadata.

  The host byte order of the machine where the process is running will be used if no byte order is set.

  The access methods provide no guarantees about the byte ordering of the application data stored in the database, and applications are responsible for maintaining any necessary ordering.

  This method configures a database, not only operations performed using the specified `Database` handle.

  This method may not be called after the database is opened. If the database already exists when it is opened, the information specified to this method will be ignored. If creating additional databases in a single physical file, information specified to this method will be ignored and the byte order of the existing databases will be used.

  Parameters:
    `byteOrder` - The byte order as an integer; for example, big endian order is the number 4,321, and little endian order is the number 1,234.

### getByteOrder

    public int getByteOrder()

  Return the database byte order; a byte order of 4,321 indicates a big endian order, and a byte order of 1,234 indicates a little endian order.

  This method may be called at any time during the life of the application.

  Returns:
    The database byte order; a byte order of 4,321 indicates a big endian order, and a byte order of 1,234 indicates a little endian order.

### getByteSwapped

    public boolean getByteSwapped()

  Return if the underlying database files were created on an architecture of the same byte order as the current one.

  This information may be used to determine whether application data needs to be adjusted for this architecture or not.

  This method may not be called before the database has been opened.

  Returns:
    Return false if the underlying database files were created on an architecture of the same byte order as the current one, and true if they were not (that is, big-endian on a little-endian machine, or vice versa).

### setBtreeCompressor

    public void setBtreeCompressor(BtreeCompressor btreeCompressor)

  Set the Btree compression callbacks.

### getBtreeCompressor

    public BtreeCompressor getBtreeCompressor()

  Get the Btree compression callbacks.

### setBtreePrefixCalculator

    public void setBtreePrefixCalculator(BtreePrefixCalculator btreePrefixCalculator)

  Set the Btree prefix callback. The prefix callback is used to determine the amount by which keys stored on the Btree internal pages can be safely truncated without losing their uniqueness. See the Btree prefix comparison section of the Berkeley DB Reference Guide for more details about how this works. The usefulness of this is data-dependent, but can produce significantly reduced tree sizes and search times in some data sets.

  If no prefix callback or key comparison callback is specified by the application, a default lexical comparison function is used to calculate prefixes. If no prefix callback is specified and a key comparison callback is specified, no prefix function is used. It is an error to specify a prefix function without also specifying a Btree key comparison function.

### getBtreePrefixCalculator

    public BtreePrefixCalculator getBtreePrefixCalculator()

  Return the Btree prefix callback.

  This method may be called at any time during the life of the application.

  Returns:
    The Btree prefix callback.

### setCacheSize

    public void setCacheSize(long cacheSize)

  Set the size of the shared memory buffer pool, that is, the size of the cache.

  The cache should be the size of the normal working data set of the application, with some small amount of additional memory for unusual situations. (Note: the working set is not the same as the number of pages accessed simultaneously, and is usually much larger.)

  The default cache size is 256KB, and may not be specified as less than 20KB. Any cache size less than 500MB is automatically increased by 25% to account for buffer pool overhead; cache sizes larger than 500MB are used as specified. The current maximum size of a single cache is 4GB. (All sizes are in powers-of-two, that is, 256KB is 2^18 not 256,000.)

  Because databases opened within database environments use the cache specified to the environment, it is an error to attempt to configure a cache size in a database created within an environment.

  This method may not be called after the database is opened.

  This method may be called at any time during the life of the application.

  Parameters:
    `cacheSize` - The size of the shared memory buffer pool, that is, the size of the cache.

  Throws:
    `DatabaseException` - if a failure occurs.

### getCacheSize

    public long getCacheSize()

  Return the size of the shared memory buffer pool, that is, the cache.

  This method may be called at any time during the life of the application.

  Returns:
    The size of the shared memory buffer pool, that is, the cache.

### setCreateDir

    public void setCreateDir(File createDir)

  Specify which directory a database should be created in or looked for.

  Parameters:
    `createDir` - The directory will be used to create or locate the database file specified in the openDatabase method call. The directory must be one of the directories in the environment list specified by EnvironmentConfig.addDataDirectory.

  Throws:
    `DatabaseException` - if a failure occurs.

### getCreateDir

    public File getCreateDir()

  Return the directory a database will/has been created in or looked for.

  This method may be called at any time during the life of the application.

  Returns:
    The directory a database will/has been created in or looked for.

### setCacheCount

    public void setCacheCount(int cacheCount)

  Set the number of shared memory buffer pools, that is, the number of caches.

  It is possible to specify caches larger than 4GB and/or large enough they cannot be allocated contiguously on some architectures. For example, some releases of Solaris limit the amount of memory that may be allocated contiguously by a process. This method allows applications to break the cache broken up into a number of equally sized, separate pieces of memory.

  Because databases opened within database environments use the cache specified to the environment, it is an error to attempt to configure multiple caches in a database created within an environment.

  This method may not be called after the database is opened.

  This method may be called at any time during the life of the application.

  Parameters:
    `cacheCount` - The number of shared memory buffer pools, that is, the number of caches.

  Throws:
    `DatabaseException` - if a failure occurs.

### getCacheCount

    public int getCacheCount()

  Return the number of shared memory buffer pools, that is, the number of caches.

  This method may be called at any time during the life of the application.

  Returns:
    The number of shared memory buffer pools, that is, the number of caches.

### setChecksum

    public void setChecksum(boolean checksum)

  Configure the database environment to do checksum verification of pages read into the cache from the backing filestore.

  Berkeley DB uses the SHA1 Secure Hash Algorithm if encryption is also configured for this database, and a general hash algorithm if it is not.

  Calling this method only affects the specified `Database` handle (and any other library handles opened within the scope of that handle).

  If the database already exists when the database is opened, any database configuration specified by this method will be ignored. If creating additional databases in a file, the checksum behavior specified must be consistent with the existing databases in the file or an error will be returned.

  Parameters:
    `checksum` - If true, configure the database environment to do checksum verification of pages read into the cache from the backing filestore. A value of false is illegal to this method, that is, once set, the configuration cannot be cleared.

### getChecksum

    public boolean getChecksum()

  Return true if the database environment is configured to do checksum verification of pages read into the cache from the backing filestore.

  This method may be called at any time during the life of the application.

  Returns:
    True if the database environment is configured to do checksum verification of pages read into the cache from the backing filestore.

### setReadUncommitted

    public void setReadUncommitted(boolean readUncommitted)

  Configure the database to support read uncommitted.

  Read operations on the database may request the return of modified but not yet committed data. This flag must be specified on all `Database` handles used to perform read uncommitted or database updates, otherwise requests for read uncommitted may not be honored and the read may block.

  Parameters:
    `readUncommitted` - If true, configure the database to support read uncommitted.

### getReadUncommitted

    public boolean getReadUncommitted()

  Return true if the database is configured to support read uncommitted.

  This method may be called at any time during the life of the application.

  Returns:
    True if the database is configured to support read uncommitted.

### setDirtyRead

    public void setDirtyRead(boolean dirtyRead)

  Deprecated. This has been replaced by `setReadUncommitted(boolean)` to conform to ANSI database isolation terminology.

  Configure the database to support read uncommitted.

  Read operations on the database may request the return of modified but not yet committed data. This flag must be specified on all `Database` handles used to perform read uncommitted or database updates, otherwise requests for read uncommitted may not be honored and the read may block.

  Parameters:
    `dirtyRead` - If true, configure the database to support read uncommitted.

### getDirtyRead

    public boolean getDirtyRead()

  Deprecated. This has been replaced by `getReadUncommitted()` to conform to ANSI database isolation terminology.

  Return true if the database is configured to support read uncommitted.

  This method may be called at any time during the life of the application.

  Returns:
    True if the database is configured to support read uncommitted.

### setDuplicateComparator

    public void setDuplicateComparator(Comparator duplicateComparator)

  Set the duplicate data item comparison callback. The comparison function is called whenever it is necessary to compare a data item specified by the application with a data item currently stored in the database. This comparator is only used if `DatabaseConfig.setSortedDuplicates` is also configured.

  If no comparison function is specified, the data items are compared lexically, with shorter data items collating before longer data items.

  The `compare` method is passed the byte arrays representing data items in the database. If you know how your data is organized in the byte array, then you can write a comparison routine that directly examines the contents of the arrays. Otherwise, you have to reconstruct your original objects, and then perform the comparison.

  Parameters:
    `duplicateComparator` - the comparison callback for duplicate data items.

### getDuplicateComparator

    public Comparator getDuplicateComparator()

  Return the duplicate data item comparison callback.

  Returns:
    the duplicate data item Comparator, or null if the default Comparator will be used.

### setEncrypted

    public void setEncrypted(String password)

  Set the password used to perform encryption and decryption.

  Because databases opened within environments use the password specified to the environment, it is an error to attempt to set a password in a database created within an environment.

  Berkeley DB uses the Rijndael/AES (also known as the Advanced Encryption Standard and Federal Information Processing Standard (FIPS) 197) algorithm for encryption or decryption.

### getEncrypted

    public boolean getEncrypted()

  Return true if the database has been configured to perform encryption.

  This method may be called at any time during the life of the application.

  Returns:
    True if the database has been configured to perform encryption.

### setErrorHandler

    public void setErrorHandler(ErrorHandler errorHandler)

  Set the function to be called if an error occurs.

  When an error occurs in the Berkeley DB library, an exception is thrown. In some cases, however, the error information returned to the application may be insufficient to completely describe the cause of the error, especially during initial application debugging.

  The `EnvironmentConfig.setErrorHandler` and `DatabaseConfig.setErrorHandler` methods are used to enhance the mechanism for reporting error messages to the application. In some cases, when an error occurs, Berkeley DB will invoke the ErrorHandler's object error method. It is up to this method to display the error message in an appropriate manner.

  Alternatively, applications can use `EnvironmentConfig.setErrorStream` and `DatabaseConfig.setErrorStream` to display the additional information via an output stream. Applications should not mix these approaches.

  This error-logging enhancement does not slow performance or significantly increase application size, and may be run during normal operation as well as during application debugging.

  For `Database` handles opened inside of database environments, calling this method affects the entire environment and is equivalent to calling `EnvironmentConfig.setErrorHandler`.

  This method may be called at any time during the life of the application.

  Parameters:
    `errorHandler` - The function to be called if an error occurs.

### getErrorHandler

    public ErrorHandler getErrorHandler()

  Return the function to be called if an error occurs.

  This method may be called at any time during the life of the application.

  Returns:
    The function to be called if an error occurs.

### setErrorPrefix

    public void setErrorPrefix(String errorPrefix)

  Set the prefix string that appears before error messages.

  For `Database` handles opened inside of database environments, calling this method affects the entire environment and is equivalent to calling `EnvironmentConfig.setErrorPrefix`.

  This method may be called at any time during the life of the application.

  Parameters:
    `errorPrefix` - The prefix string that appears before error messages.

### getErrorPrefix

    public String getErrorPrefix()

  Return the prefix string that appears before error messages.

  This method may be called at any time during the life of the application.

  Returns:
    The prefix string that appears before error messages.

### setErrorStream

    public void setErrorStream(OutputStream errorStream)

  Set an OutputStream for displaying error messages.

  When an error occurs in the Berkeley DB library, an exception is thrown. In some cases, however, the error information returned to the application may be insufficient to completely describe the cause of the error, especially during initial application debugging.

  The `EnvironmentConfig.setErrorStream` and `DatabaseConfig.setErrorStream` methods are used to enhance the mechanism for reporting error messages to the application by setting a OutputStream to be used for displaying additional Berkeley DB error messages. In some cases, when an error occurs, Berkeley DB will output an additional error message to the specified stream.

  The error message will consist of the prefix string and a colon (":") (if a prefix string was previously specified using `EnvironmentConfig.setErrorPrefix` or `DatabaseConfig.setErrorPrefix`), an error string, and a trailing newline character.

  Setting errorStream to null unconfigures the interface.

  Alternatively, applications can use `EnvironmentConfig.setErrorHandler` and `DatabaseConfig.setErrorHandler` to capture the additional error information in a way that does not use output streams. Applications should not mix these approaches.

  This error-logging enhancement does not slow performance or significantly increase application size, and may be run during normal operation as well as during application debugging.

  This method may be called at any time during the life of the application.

  Parameters:
    `errorStream` - The application-specified OutputStream for error messages.

### getErrorStream

    public OutputStream getErrorStream()

  Return the an OutputStream for displaying error messages.

  This method may be called at any time during the life of the application.

  Returns:
    The an OutputStream for displaying error messages.

### setExclusiveCreate

    public void setExclusiveCreate(boolean exclusiveCreate)

  Configure the `Environment.openDatabase` method to fail if the database already exists.

  The exclusiveCreate mode is only meaningful if specified with the allowCreate mode.

  Parameters:
    `exclusiveCreate` - If true, configure the `Environment.openDatabase` method to fail if the database already exists.

### getExclusiveCreate

    public boolean getExclusiveCreate()

  Return true if the `Environment.openDatabase` method is configured to fail if the database already exists.

  This method may be called at any time during the life of the application.

  Returns:
    True if the `Environment.openDatabase` method is configured to fail if the database already exists.

### setFeedbackHandler

    public void setFeedbackHandler(FeedbackHandler feedbackHandler)

  Set an object whose methods are called to provide feedback.

  Some operations performed by the Berkeley DB library can take non-trivial amounts of time. This method can be used by applications to monitor progress within these operations. When an operation is likely to take a long time, Berkeley DB will call the object's methods with progress information.

  It is up to the object's methods to display this information in an appropriate manner.

  This method configures only operations performed using a single a `Environment` handle

  This method may be called at any time during the life of the application.

  Parameters:
    `feedbackHandler` - An object whose methods are called to provide feedback.

### getFeedbackHandler

    public FeedbackHandler getFeedbackHandler()

  Return the object's methods to be called to provide feedback.

  This method may be called at any time during the life of the application.

  Returns:
    The object's methods to be called to provide feedback.

### setHashFillFactor

    public void setHashFillFactor(int hashFillFactor)

  Set the desired density within the hash table.

  If no value is specified, the fill factor will be selected dynamically as pages are filled.

  The density is an approximation of the number of keys allowed to accumulate in any one bucket, determining when the hash table grows or shrinks. If you know the average sizes of the keys and data in your data set, setting the fill factor can enhance performance. A reasonable rule computing fill factor is to set it to the following:

  >             (pagesize - 32) / (average_key_size + average_data_size + 8)

  This method configures a database, not only operations performed using the specified `Database` handle.

  This method may not be called after the database is opened. If the database already exists when it is opened, the information specified to this method will be ignored.

  Parameters:
    `hashFillFactor` - The desired density within the hash table.

### getHashFillFactor

    public int getHashFillFactor()

  Return the hash table density.

  This method may be called at any time during the life of the application.

  Returns:
    The hash table density.

### setHashComparator

    public void setHashComparator(Comparator hashComparator)

  Set the Hash key comparison function. The comparison function is called whenever it is necessary to compare a key specified by the application with a key currently stored in the database.

  If no comparison function is specified, a byte-by-byte comparison is performed.

  The `compare` method is passed the byte arrays representing keys that are stored in the database. If you know how your data is organized in the byte array, then you can write a comparison routine that directly examines the contents of the arrays. Otherwise, you have to reconstruct your original objects, and then perform the comparison.

### getHashComparator

    public Comparator getHashComparator()

  Return the Comparator used to compare keys in a Hash database.

  This method may be called at any time during the life of the application.

  Returns:
    The Comparator used to compare keys in a Hash database.

### setHasher

    public void setHasher(Hasher hasher)

  Set a database-specific hash function.

  If no hash function is specified, a default hash function is used. Because no hash function performs equally well on all possible data, the user may find that the built-in hash function performs poorly with a particular data set.

  This method configures operations performed using the specified `Database` object, not all operations performed on the underlying database.

  This method may not be called after the database is opened. If the database already exists when it is opened, the information specified to this method must be the same as that historically used to create the database or corruption can occur.

  Parameters:
    `hasher` - A database-specific hash function.

### getHasher

    public Hasher getHasher()

  Return the database-specific hash function.

  This method may be called at any time during the life of the application.

  Returns:
    The database-specific hash function.

### setHashNumElements

    public void setHashNumElements(int hashNumElements)

  Set an estimate of the final size of the hash table.

  In order for the estimate to be used when creating the database, the `DatabaseConfig.setHashFillFactor` method must also be called. If the estimate or fill factor are not set or are set too low, hash tables will still expand gracefully as keys are entered, although a slight performance degradation may be noticed.

  This method configures a database, not only operations performed using the specified `Database` handle.

  This method may not be called after the database is opened. If the database already exists when it is opened, the information specified to this method will be ignored.

  Parameters:
    `hashNumElements` - An estimate of the final size of the hash table.

### getHashNumElements

    public int getHashNumElements()

  Return the estimate of the final size of the hash table.

  This method may be called at any time during the life of the application.

  Returns:
    The estimate of the final size of the hash table.

### setHeapsize

    public void setHeapsize(long bytes)

  Set the maximum on-disk database file size used by a database configured to use the Heap access method. If this method is never called, the database's file size can grow without bound. If this method is called, then the heap file can never grow larger than the limit defined by this method. In that case, attempts to update or create records in a Heap database that has reached its maximum size will throw a `HeapFullException`.

  The size specified to this method must be at least three times the database page size. That is, a Heap database must contain at least three database pages. You can set the database page size using `setPageSize(int)`.

  This method may not be called after the database is opened. Further, if this method is called on an existing Heap database, the size specified here must match the size used to create the database. Note, however, that specifying an incorrect size to this method will not result in an error return until the database is opened.

  Parameters:
    `bytes` - The maximum on-disk database file size.

### getHeapsize

    public long getHeapsize()

  Return the maximum on-disk database file size.

  This method may be called at any time during the life of the application.

  Returns:
    The maximum on-disk database file size.

### setHeapRegionSize

    public void setHeapRegionSize(int npages)

  Sets the number of pages in a region of a database configured to use the Heap access method. If this method is never called, the default region size for the database's page size will be used. You can set the database page size using `setPageSize(int)`.

  This method may not be called after the database is opened. Further, if this method is called on an existing Heap database, the value specified here will be ignored. If the specified region size is larger than the maximum region size for the database's page size, an error will be returned when the database is opened. The maximum allowable region size will be included in the error message.

  Parameters:
    `npages` - The size of the region, in pages.

### getHeapRegionSize

    public long getHeapRegionSize()

  Return the number of pages in a region of the database.

  This method may be called at any time during the life of the application.

  Returns:
    The size of the region, in pages.

### setMessageHandler

    public void setMessageHandler(MessageHandler messageHandler)

  Set a function to be called with an informational message.

  There are interfaces in the Berkeley DB library which either directly output informational messages or statistical information, or configure the library to output such messages when performing other operations, `EnvironmentConfig.setVerboseDeadlock` for example.

  The `EnvironmentConfig.setMessageHandler` and `DatabaseConfig.setMessageHandler` methods are used to display these messages for the application.

  Setting messageHandler to null unconfigures the interface.

  Alternatively, you can use `EnvironmentConfig.setMessageStream` and `DatabaseConfig.setMessageStream` to send the additional information directly to an output streams. You should not mix these approaches.

  For `Database` handles opened inside of database environments, calling this method affects the entire environment and is equivalent to calling `EnvironmentConfig.setMessageHandler`.

  This method may be called at any time during the life of the application.

  Parameters:
    `messageHandler` - The application-specified function for informational messages.

### getMessageHandler

    public MessageHandler getMessageHandler()

  Return the function to be called with an informational message.

  This method may be called at any time during the life of the application.

  Returns:
    The function to be called with an informational message.

### setMessageStream

    public void setMessageStream(OutputStream messageStream)

  Set an OutputStream for displaying informational messages.

  There are interfaces in the Berkeley DB library which either directly output informational messages or statistical information, or configure the library to output such messages when performing other operations, `EnvironmentConfig.setVerboseDeadlock` for example.

  The `EnvironmentConfig.setMessageStream` and `DatabaseConfig.setMessageStream` methods are used to display these messages for the application. In this case, the message will include a trailing newline character.

  Setting messageStream to null unconfigures the interface.

  Alternatively, you can use `EnvironmentConfig.setMessageHandler` and `DatabaseConfig.setMessageHandler` to capture the additional information in a way that does not use output streams. You should not mix these approaches.

  For `Database` handles opened inside of database environments, calling this method affects the entire environment and is equivalent to calling `EnvironmentConfig.setMessageStream`.

  This method may be called at any time during the life of the application.

  Parameters:
    `messageStream` - The application-specified OutputStream for informational messages.

### getMessageStream

    public OutputStream getMessageStream()

  Return the an OutputStream for displaying informational messages.

  This method may be called at any time during the life of the application.

  Returns:
    The an OutputStream for displaying informational messages.

### setMode

    public void setMode(int mode)

  On UNIX systems or in IEEE/ANSI Std 1003.1 (POSIX) environments, files created by the database open are created with mode `mode` (as described in the `chmod`(2) manual page) and modified by the process' umask value at the time of creation (see the `umask`(2) manual page). Created files are owned by the process owner; the group ownership of created files is based on the system and directory defaults, and is not further specified by Berkeley DB. System shared memory segments created by the database open are created with mode `mode`, unmodified by the process' umask value. If `mode` is 0, the database open will use a default mode of readable and writable by both owner and group.

  On Windows systems, the mode parameter is ignored.

  Parameters:
    `mode` - the mode used to create files

### getMode

    public long getMode()

  Return the mode used to create files.

  This method may be called at any time during the life of the application.

  Returns:
    The mode used to create files.

### setMultiversion

    public void setMultiversion(boolean multiversion)

  Configured the database with support for multiversion concurrency control. This will cause updates to the database to follow a copy-on-write protocol, which is required to support Snapshot Isolation. See `TransactionConfig.setSnapshot(boolean)`) for more information. Multiversion access requires that the database be opened in a transaction and is not supported for queue databases.

  Parameters:
    `multiversion` - If true, configure the database with support for multiversion concurrency control.

### getMultiversion

    public boolean getMultiversion()

  Return true if the database is configured for multiversion concurrency control.

  This method may be called at any time during the life of the application.

  Returns:
    True if the database is configured for multiversion concurrency control.

### setNoMMap

    public void setNoMMap(boolean noMMap)

  Configure the library to not map this database into memory.

  Parameters:
    `noMMap` - If true, configure the library to not map this database into memory.

### getNoMMap

    public boolean getNoMMap()

  Return true if the library is configured to not map this database into memory.

  This method may be called at any time during the life of the application.

  Returns:
    True if the library is configured to not map this database into memory.

### setNoWaitDbExclusiveLock

    public void setNoWaitDbExclusiveLock(Boolean noWaitDbExclLock)

  Configure the `Database` handle to obtain a write lock on the entire database.

  This method may not be called after the database is opened.

  Parameters:
    `noWaitDbExclLock` - If True, configure the `Database` handle to obtain a write lock on the entire database. When the database is opened it will immediately throw `LockNotGrantedException` if it cannot obtain the exclusive lock immediately. If False, configure the `Database` handle to obtain a write lock on the entire database. When the database is opened, it will block until it can obtain the exclusive lock. If null, do not configure the `Database` handle to obtain a write lock on the entire database.

    Handles configured for a write lock on the entire database can only have one active transaction at a time.

### getNoWaitDbExclusiveLock

    public Boolean getNoWaitDbExclusiveLock()

  Return whether the `Database` handle is configured to obtain a write lock on the entire database.

  This method may be called at any time during the life of the application.

  Returns:
    True if the `Database` handle is configured for immediate exclusive database locking. In this case, the locking operation will error out if it cannot immediately obtain an exclusive lock. False if the `Database` handle is configured for exclusive database locking. In this case, it will block until it can obtain the exclusive database lock when database is opened. Null if the `Database` handle is not configured for exclusive locking.

### setPageSize

    public void setPageSize(int pageSize)

  Set the size of the pages used to hold items in the database, in bytes.

  The minimum page size is 512 bytes, the maximum page size is 64K bytes, and the page size must be a power-of-two. If the page size is not explicitly set, one is selected based on the underlying filesystem I/O block size. The automatically selected size has a lower limit of 512 bytes and an upper limit of 16K bytes.

  This method configures a database, not only operations performed using the specified `Database` handle.

  This method may not be called after the database is opened. If the database already exists when it is opened, the information specified to this method will be ignored. If creating additional databases in a file, the page size specified must be consistent with the existing databases in the file or an error will be returned.

  Parameters:
    `pageSize` - The size of the pages used to hold items in the database, in bytes.

### getPageSize

    public int getPageSize()

  Return the size of the pages used to hold items in the database, in bytes.

  This method may be called at any time during the life of the application.

  Returns:
    The size of the pages used to hold items in the database, in bytes.

### setPanicHandler

    public void setPanicHandler(PanicHandler panicHandler)

  Set the function to be called if the database environment panics.

  Errors can occur in the Berkeley DB library where the only solution is to shut down the application and run recovery (for example, if Berkeley DB is unable to allocate heap memory). In such cases, the Berkeley DB methods will throw a `RunRecoveryException`. It is often easier to simply exit the application when such errors occur rather than gracefully return up the stack. This method specifies a function to be called when `RunRecoveryException` is about to be thrown from a Berkeley DB method.

  For `Database` handles opened inside of database environments, calling this method affects the entire environment and is equivalent to calling `EnvironmentConfig.setPanicHandler`.

  This method may be called at any time during the life of the application.

  Parameters:
    `panicHandler` - The function to be called if the database environment panics.

### getPanicHandler

    public PanicHandler getPanicHandler()

  Return the function to be called if the database environment panics.

  This method may be called at any time during the life of the application.

  Returns:
    The function to be called if the database environment panics.

### setPartitionByCallback

    public void setPartitionByCallback(int parts,
                                       PartitionHandler partitionHandler)

  Enable or disable database partitioning, and set the callback that will be used for the partitioning.

  This method may only be called before opening a database.

  Parameters:
    `parts` - The number of partitions that will be created.

    `partitionHandler` - The function to be called to determine which partition a key resides in.

### setPartitionByRange

    public void setPartitionByRange(int parts,
                                    MultipleDataEntry keys)

  Enable or disable database partitioning, and set key ranges that will be used for the partitioning.

  This method may only be called before opening a database.

  Parameters:
    `parts` - The number of partitions that will be created.

    `keys` - A MultipleDatabaseEntry that contains the boundary keys for partitioning.

### getPartitionHandler

    public PartitionHandler getPartitionHandler()

  Return the function to be called to determine which partition a key resides in.

  This method may be called at any time during the life of the application.

  Returns:
    The function to be called to determine which partition a key resides in.

### getPartitionParts

    public int getPartitionParts()

  Return the number of partitions the database is configured for.

  This method may be called at any time during the life of the application.

  Returns:
    The number of partitions the database is configured for.

### getPartitionKeys

    public DatabaseEntry getPartitionKeys()

  Return the array of keys the database is configured to partition with.

  This method may be called at any time during the life of the application.

  Returns:
    The array of keys the database is configured to partition with.

### setPartitionDirs

    public void setPartitionDirs(File[] dirs)

  Specify the array of directories the database extents should be created in or looked for. If the number of directories is less than the number of partitions, the directories will be used in a round robin fasion.

  This method may only be called before the database is opened.

  Parameters:
    `dirs` - The array of directories the database extents should be created in or looked for.

### getPartitionDirs

    public File[] getPartitionDirs()

  Return the array of directories the database extents should be created in or looked for. If the number of directories is less than the number of partitions, the directories will be used in a round robin fasion.

  This method may be called at any time during the life of the application.

  Returns:
    The array of directories the database extents should be created in or looked for.

### setPriority

    public void setPriority(CacheFilePriority priority)

  Set the cache priority for pages referenced by the DB handle.

  The priority of a page biases the replacement algorithm to be more or less likely to discard a page when space is needed in the buffer pool. The bias is temporary, and pages will eventually be discarded if they are not referenced again. The priority setting is only advisory, and does not guarantee pages will be treated in a specific way.

  Parameters:
    `priority` - The desired cache priority.

### getPriority

    public CacheFilePriority getPriority()

  Return the the cache priority for pages referenced by this handle.

  This method may be called at any time during the life of the application.

  Returns:
    The the cache priority for pages referenced by this handle.

### setQueueExtentSize

    public void setQueueExtentSize(int queueExtentSize)

  Set the size of the extents used to hold pages in a Queue database, specified as a number of pages.

  Each extent is created as a separate physical file. If no extent size is set, the default behavior is to create only a single underlying database file.

  This method configures a database, not only operations performed using the specified `Database` handle.

  This method may not be called after the database is opened. If the database already exists when it is opened, the information specified to this method will be ignored.

  Parameters:
    `queueExtentSize` - The number of pages in a Queue database extent.

### getQueueExtentSize

    public int getQueueExtentSize()

  Return the size of the extents used to hold pages in a Queue database, specified as a number of pages.

  This method may be called at any time during the life of the application.

  Returns:
    The size of the extents used to hold pages in a Queue database, specified as a number of pages.

### setQueueInOrder

    public void setQueueInOrder(boolean queueInOrder)

  Configure `Database.consume` to return key/data pairs in order, always returning the key/data item from the head of the queue.

  The default behavior of queue databases is optimized for multiple readers, and does not guarantee that record will be retrieved in the order they are added to the queue. Specifically, if a writing thread adds multiple records to an empty queue, reading threads may skip some of the initial records when the next call to retrieve a key/data pair returns.

  This flag configures the `Database.consume` method to verify that the record being returned is in fact the head of the queue. This will increase contention and reduce concurrency when there are many reading threads.

  Calling this method only affects the specified `Database` handle (and any other library handles opened within the scope of that handle).

  Parameters:
    `queueInOrder` - If true, configure the `Database.consume` method to return key/data pairs in order, always returning the key/data item from the head of the queue. A value of false is illegal to this method, that is, once set, the configuration cannot be cleared.

### getQueueInOrder

    public boolean getQueueInOrder()

  Return true if the `Database.consume` method is configured to return key/data pairs in order, always returning the key/data item from the head of the queue.

  This method may be called at any time during the life of the application.

  Returns:
    True if the `Database.consume` method is configured to return key/data pairs in order, always returning the key/data item from the head of the queue.

### setReadOnly

    public void setReadOnly(boolean readOnly)

  Configure the database in read-only mode.

  Any attempt to modify items in the database will fail, regardless of the actual permissions of any underlying files.

  Parameters:
    `readOnly` - If true, configure the database in read-only mode.

### getReadOnly

    public boolean getReadOnly()

  Return true if the database is configured in read-only mode.

  This method may be called at any time during the life of the application.

  Returns:
    True if the database is configured in read-only mode.

### setRecordNumberAppender

    public void setRecordNumberAppender(RecordNumberAppender recnoAppender)

  Configure `Database.append` to call the function after the record number has been selected but before the data has been stored into the database.

  This method configures operations performed using the specified `Database` object, not all operations performed on the underlying database.

  This method may not be called after the database is opened.

  Parameters:
    `recnoAppender` - The function to call after the record number has been selected but before the data has been stored into the database.

### getRecordNumberAppender

    public RecordNumberAppender getRecordNumberAppender()

  Return the function to call after the record number has been selected but before the data has been stored into the database.

  This method may be called at any time during the life of the application.

  Returns:
    The function to call after the record number has been selected but before the data has been stored into the database.

### setRecordDelimiter

    public void setRecordDelimiter(int recordDelimiter)

  Set the delimiting byte used to mark the end of a record in the backing source file for the Recno access method.

  This byte is used for variable length records if a backing source file is specified. If a backing source file is specified and no delimiting byte was specified, newline characters (that is, ASCII 0x0a) are interpreted as end-of-record markers.

  This method configures a database, not only operations performed using the specified `Database` handle.

  This method may not be called after the database is opened. If the database already exists when it is opened, the information specified to this method will be ignored.

  Parameters:
    `recordDelimiter` - The delimiting byte used to mark the end of a record in the backing source file for the Recno access method.

### getRecordDelimiter

    public int getRecordDelimiter()

  Return the delimiting byte used to mark the end of a record in the backing source file for the Recno access method.

  This method may be called at any time during the life of the application.

  Returns:
    The delimiting byte used to mark the end of a record in the backing source file for the Recno access method.

### setRecordLength

    public void setRecordLength(int recordLength)

  Specify the database record length, in bytes.

  For the Queue access method, specify the record length. For the Queue access method, the record length must be enough smaller than the database's page size that at least one record plus the database page's metadata information can fit on each database page.

  For the Recno access method, specify the records are fixed-length, not byte-delimited, and the record length.

  Any records added to the database that are less than the specified length are automatically padded (see `DatabaseConfig.setRecordPad` for more information).

  Any attempt to insert records into the database that are greater than the specified length will cause the call to fail.

  This method configures a database, not only operations performed using the specified `Database` handle.

  This method may not be called after the database is opened. If the database already exists when it is opened, the information specified to this method will be ignored.

  Parameters:
    `recordLength` - The database record length, in bytes.

### getRecordLength

    public int getRecordLength()

  Return the database record length, in bytes.

  This method may be called at any time during the life of the application.

  Returns:
    The database record length, in bytes.

### setBtreeRecordNumbers

    public void setBtreeRecordNumbers(boolean btreeRecordNumbers)

  Configure the Btree to support retrieval by record number.

  Logical record numbers in Btree databases are mutable in the face of record insertion or deletion.

  Maintaining record counts within a Btree introduces a serious point of contention, namely the page locations where the record counts are stored. In addition, the entire database must be locked during both insertions and deletions, effectively single-threading the database for those operations. Configuring a Btree for retrieval by record number can result in serious performance degradation for some applications and data sets.

  Retrieval by record number may not be configured for a Btree that also supports duplicate data items.

  Calling this method affects the database, including all threads of control accessing the database.

  If the database already exists when the database is opened, any database configuration specified by this method must be the same as the existing database or an error will be returned.

  Parameters:
    `btreeRecordNumbers` - If true, configure the Btree to support retrieval by record number. A value of false is illegal to this method, that is, once set, the configuration cannot be cleared.

### getBtreeRecordNumbers

    public boolean getBtreeRecordNumbers()

  Return true if the Btree is configured to support retrieval by record number.

  This method may be called at any time during the life of the application.

  Returns:
    True if the Btree is configured to support retrieval by record number.

### setRecordPad

    public void setRecordPad(int recordPad)

  Set the padding character for short, fixed-length records for the Queue and Recno access methods.

  If no pad character is specified, "space" characters (that is, ASCII 0x20) are used for padding.

  This method configures a database, not only operations performed using the specified `Database` handle.

  This method may not be called after the database is opened. If the database already exists when it is opened, the information specified to this method will be ignored.

  Parameters:
    `recordPad` - The padding character for short, fixed-length records for the Queue and Recno access methods.

### getRecordPad

    public int getRecordPad()

  Return the padding character for short, fixed-length records for the Queue and Recno access methods.

  This method may be called at any time during the life of the application.

  Returns:
    The padding character for short, fixed-length records for the Queue and Recno access methods.

### setRecordSource

    public void setRecordSource(File recordSource)

  Set the underlying source file for the Recno access method.

  The purpose of the source file is to provide fast access and modification to databases that are normally stored as flat text files.

  The recordSource parameter specifies an underlying flat text database file that is read to initialize a transient record number index. In the case of variable length records, the records are separated, as specified by the `DatabaseConfig.setRecordDelimiter` method. For example, standard UNIX byte stream files can be interpreted as a sequence of variable length records separated by newline characters (that is, ASCII 0x0a).

  In addition, when cached data would normally be written back to the underlying database file (for example, the `Database.close` or `Database.sync` methods are called), the in-memory copy of the database will be written back to the source file.

  By default, the backing source file is read lazily; that is, records are not read from the file until they are requested by the application. If multiple processes (not threads) are accessing a Recno database concurrently, and are either inserting or deleting records, the backing source file must be read in its entirety before more than a single process accesses the database, and only that process should specify the backing source file as part of opening the database. See the `DatabaseConfig.setSnapshot` method for more information.

  Reading and writing the backing source file cannot be transaction-protected because it involves filesystem operations that are not part of the `Database` transaction methodology. For this reason, if a temporary database is used to hold the records, it is possible to lose the contents of the source file, for example, if the system crashes at the right instant. If a file is used to hold the database, normal database recovery on that file can be used to prevent information loss, although it is still possible that the contents of the source file will be lost if the system crashes.

  The source file must already exist (but may be zero-length) when the database is opened.

  It is not an error to specify a read-only source file when creating a database, nor is it an error to modify the resulting database. However, any attempt to write the changes to the backing source file using either the `Database.sync` or `Database.close` methods will fail, of course. Specify the noSync argument to the `Database.close` method to stop it from attempting to write the changes to the backing file; instead, they will be silently discarded.

  For all of the previous reasons, the source file is generally used to specify databases that are read-only for Berkeley DB applications; and that are either generated on the fly by software tools or modified using a different mechanism -- for example, a text editor.

  This method configures operations performed using the specified `Database` object, not all operations performed on the underlying database.

  This method may not be called after the database is opened. If the database already exists when it is opened, the information specified to this method must be the same as that historically used to create the database or corruption can occur.

  Parameters:
    `recordSource` - The name of an underlying flat text database file that is read to initialize a transient record number index. In the case of variable length records, the records are separated, as specified by the `DatabaseConfig.setRecordDelimiter` method. For example, standard UNIX byte stream files can be interpreted as a sequence of variable length records separated by newline characters (that is, ASCII 0x0a).

### getRecordSource

    public File getRecordSource()

  Return the name of an underlying flat text database file that is read to initialize a transient record number index.

  This method may be called at any time during the life of the application.

  Returns:
    The name of an underlying flat text database file that is read to initialize a transient record number index.

### setRenumbering

    public void setRenumbering(boolean renumbering)

  Configure the logical record numbers to be mutable, and change as records are added to and deleted from the database.

  For example, the deletion of record number 4 causes records numbered 5 and greater to be renumbered downward by one. If a cursor was positioned to record number 4 before the deletion, it will refer to the new record number 4, if any such record exists, after the deletion. If a cursor was positioned after record number 4 before the deletion, it will be shifted downward one logical record, continuing to refer to the same record as it did before.

  Creating new records will cause the creation of multiple records if the record number is more than one greater than the largest record currently in the database. For example, creating record 28, when record 25 was previously the last record in the database, will create records 26 and 27 as well as 28. Attempts to retrieve records that were created in this manner will result in an error return of `OperationStatus.KEYEMPTY`.

  If a created record is not at the end of the database, all records following the new record will be automatically renumbered upward by one. For example, the creation of a new record numbered 8 causes records numbered 8 and greater to be renumbered upward by one. If a cursor was positioned to record number 8 or greater before the insertion, it will be shifted upward one logical record, continuing to refer to the same record as it did before.

  For these reasons, concurrent access to a Recno database configured with mutable record numbers may be largely meaningless, although it is supported.

  Calling this method affects the database, including all threads of control accessing the database.

  If the database already exists when the database is opened, any database configuration specified by this method must be the same as the existing database or an error will be returned.

  Parameters:
    `renumbering` - If true, configure the logical record numbers to be mutable, and change as records are added to and deleted from the database. A value of false is illegal to this method, that is, once set, the configuration cannot be cleared.

### getRenumbering

    public boolean getRenumbering()

  Return true if the logical record numbers are mutable, and change as records are added to and deleted from the database.

  This method may be called at any time during the life of the application.

  Returns:
    True if the logical record numbers are mutable, and change as records are added to and deleted from the database.

### setReverseSplitOff

    public void setReverseSplitOff(boolean reverseSplitOff)

  Configure the Btree to not do reverse splits.

  As pages are emptied in a database, the Btree implementation attempts to coalesce empty pages into higher-level pages in order to keep the database as small as possible and minimize search time. This can hurt performance in applications with cyclical data demands; that is, applications where the database grows and shrinks repeatedly. For example, because Berkeley DB does page-level locking, the maximum level of concurrency in a database of two pages is far smaller than that in a database of 100 pages, so a database that has shrunk to a minimal size can cause severe deadlocking when a new cycle of data insertion begins.

  Calling this method only affects the specified `Database` handle (and any other library handles opened within the scope of that handle).

  Parameters:
    `reverseSplitOff` - If true, configure the Btree to not do reverse splits. A value of false is illegal to this method, that is, once set, the configuration cannot be cleared.

### getReverseSplitOff

    public boolean getReverseSplitOff()

  Return true if the Btree has been configured to not do reverse splits.

  This method may be called at any time during the life of the application.

  Returns:
    True if the Btree has been configured to not do reverse splits.

### setSortedDuplicates

    public void setSortedDuplicates(boolean sortedDuplicates)

  Configure the database to support sorted, duplicate data items.

  Insertion when the key of the key/data pair being inserted already exists in the database will be successful. The ordering of duplicates in the database is determined by the duplicate comparison function.

  If the application does not specify a duplicate data item comparison function, a default lexical comparison will be used.

  If a primary database is to be associated with one or more secondary databases, it may not be configured for duplicates.

  A Btree that supports duplicate data items cannot also be configured for retrieval by record number.

  Calling this method affects the database, including all threads of control accessing the database.

  If the database already exists when the database is opened, any database configuration specified by this method must be the same as the existing database or an error will be returned.

  Parameters:
    `sortedDuplicates` - If true, configure the database to support duplicate data items. A value of false is illegal to this method, that is, once set, the configuration cannot be cleared.

### getSortedDuplicates

    public boolean getSortedDuplicates()

  Return true if the database is configured to support sorted duplicate data items.

  This method may be called at any time during the life of the application.

  Returns:
    True if the database is configured to support sorted duplicate data items.

### setUnsortedDuplicates

    public void setUnsortedDuplicates(boolean unsortedDuplicates)

  Configure the database to support unsorted duplicate data items.

  Insertion when the key of the key/data pair being inserted already exists in the database will be successful. The ordering of duplicates in the database is determined by the order of insertion, unless the ordering is otherwise specified by use of a database cursor operation.

  If a primary database is to be associated with one or more secondary databases, it may not be configured for duplicates.

  Sorted duplicates are preferred to unsorted duplicates for performance reasons. Unsorted duplicates should only be used by applications wanting to order duplicate data items manually.

  Calling this method affects the database, including all threads of control accessing the database.

  If the database already exists when the database is opened, any database configuration specified by this method must be the same as the existing database or an error will be returned.

  Parameters:
    `unsortedDuplicates` - If true, configure the database to support unsorted duplicate data items. A value of false is illegal to this method, that is, once set, the configuration cannot be cleared.

### getUnsortedDuplicates

    public boolean getUnsortedDuplicates()

  Return true if the database is configured to support duplicate data items.

  This method may be called at any time during the life of the application.

  Returns:
    True if the database is configured to support duplicate data items.

### setSnapshot

    public void setSnapshot(boolean snapshot)

  Specify that any specified backing source file be read in its entirety when the database is opened.

  If this flag is not specified, the backing source file may be read lazily.

  Calling this method only affects the specified `Database` handle (and any other library handles opened within the scope of that handle).

  Parameters:
    `snapshot` - If true, any specified backing source file will be read in its entirety when the database is opened. A value of false is illegal to this method, that is, once set, the configuration cannot be cleared.

### getSnapshot

    public boolean getSnapshot()

  Return true if the any specified backing source file will be read in its entirety when the database is opened.

  This method may be called at any time during the life of the application.

  Returns:
    True if the any specified backing source file will be read in its entirety when the database is opened.

### getTransactional

    public boolean getTransactional()

  Return true if the database open is enclosed within a transaction.

  This method may be called at any time during the life of the application.

  Returns:
    True if the database open is enclosed within a transaction.

### setTransactional

    public void setTransactional(boolean transactional)

  Enclose the database open within a transaction.

  If the call succeeds, the open operation will be recoverable. If the call fails, no database will have been created.

  All future operations on this database, which are not explicitly enclosed in a transaction by the application, will be enclosed in in a transaction within the library.

  Parameters:
    `transactional` - If true, enclose the database open within a transaction.

### setTransactionNotDurable

    public void setTransactionNotDurable(boolean transactionNotDurable)

  Configure the database environment to not write log records for this database.

  This means that updates of this database exhibit the ACI (atomicity, consistency, and isolation) properties, but not D (durability); that is, database integrity will be maintained, but if the application or system fails, integrity will not persist. The database file must be verified and/or restored from backup after a failure. In order to ensure integrity after application shut down, the database must be flushed to disk before the database handles are closed, or all database changes must be flushed from the database environment cache using `Environment.checkpoint`.

  All database handles for a single physical file must call this method, including database handles for different databases in a physical file.

  Calling this method only affects the specified `Database` handle (and any other library handles opened within the scope of that handle).

  Parameters:
    `transactionNotDurable` - If true, configure the database environment to not write log records for this database. A value of false is illegal to this method, that is, once set, the configuration cannot be cleared.

### getTransactionNotDurable

    public boolean getTransactionNotDurable()

  Return true if the database environment is configured to not write log records for this database.

  This method may be called at any time during the life of the application.

  Returns:
    True if the database environment is configured to not write log records for this database.

### setTruncate

    public void setTruncate(boolean truncate)

  Configure the database to be physically truncated by truncating the underlying file, discarding all previous databases it might have held.

  Underlying filesystem primitives are used to implement this configuration. For this reason, it is applicable only to a physical file and cannot be used to discard databases within a file.

  This configuration option cannot be lock or transaction-protected, and it is an error to specify it in a locking or transaction-protected database environment.

  Parameters:
    `truncate` - If true, configure the database to be physically truncated by truncating the underlying file, discarding all previous databases it might have held.

### getTruncate

    public boolean getTruncate()

  Return true if the database has been configured to be physically truncated by truncating the underlying file, discarding all previous databases it might have held.

  This method may be called at any time during the life of the application.

  Returns:
    True if the database has been configured to be physically truncated by truncating the underlying file, discarding all previous databases it might have held.

### setType

    public void setType(DatabaseType type)

  Configure the type of the database.

  If they type is DB_UNKNOWN, the database must already exist.

  Parameters:
    `type` - The type of the database.

### getType

    public DatabaseType getType()

  Return the type of the database.

  This method may be used to determine the type of the database after opening it.

  This method may not be called before the database has been opened.

  Returns:
    The type of the database.

Berkeley DB version 5.3.15

Copyright (c) 1996, 2011 Oracle and/or its affiliates. All rights reserved.