Before describing the Java API usage, it is first useful to examine the exceptions thrown by those APIs. So, briefly, this section describes the exceptions that you can generally expect to encounter when writing JE applications. This list is not definitive. Exceptions beyond these can be expected, depending on the specific database activity you are performing. See the Javadoc for more information.
All of the JE APIs throw
DatabaseException
.
DatabaseException extends
java.lang.Exception
. Also, the following
classes are subclasses of DatabaseException
:
Thrown whenever an operation requires a database, and that database cannot be found.
Indicates that you have reached your disk usage thresholds. Writes are no longer allowed when these thresholds are exceeded. The thresholds are set using the EnvironmentConfig.MAX_DISK and EnvironmentConfig.FREE_DISK properties. This exception can be thrown as the result of any write operation, including database record writes, checkpoints, and database and environment syncs.
When closing the environment, this exception can be seen. However, the environment will still be properly closed.
For information on setting these properties, see Setting Disk Thresholds.
Indicates that a failure has occurred that could impact the Environment as
a whole. Depending on the nature of the failure, this exception might
indicate that Environment.close() should
be called. Use Environment.isValid() to
determine if all Environment handles must
be reopened. If true
, the environment can
continue operating without being reopened.
The common base class for all exceptions that result from record lock conflicts. Upon receiving this exception, any open cursors must be closed, the enclosing transaction aborted and, optionally, the transaction retried. Transactions are described in the Berkeley DB, Java Edition Getting Started with Transaction Processing guide.
Thrown when an IOException
or other failure occurs
when writing to the JE log. This exception might be indicative of a
full disk, although an IOException
does not contain
enough information to determine this definitively.
This exception can be thrown as the result of any write operation, including database record writes, checkpoints, and database and environment syncs.
Note that DatabaseException
and its subclasses belong to the
com.sleepycat.je
package.