###

Berkeley DB Reference Guide:
  Java API

### Java FAQ

1. During one of the first calls to the Berkeley DB Java API, a DbException is thrown with a "Bad file number" or "Bad file descriptor" message.

   There are known large-file support bugs under JNI in various releases of the JDK. Please upgrade to the latest release of the JDK, and, if that does not solve the problem, disable big file support using the --disable-largefile configuration option.

2. How can I use native methods from a debug build of the Java library?

   The Berkeley DB Java code checks a system property for the library name before defaulting to the released library. On Windows, run as follows (note the 'd' at the end):

   >     % java -Dsleepycat.db.libname=libdb_java-VERSIONd

   On UNIX, try:

   >     % java -Dsleepycat.db.libname=db_java_g-VERSION

3. How should I incorporate db.jar and the db native library into a Tomcat or other J2EE application servers?

   Tomcat and other J2EE application servers have the ability to rebuild and reload code automatically. When using Tomcat this is the case when "reloadable" is set to "true". If your WAR file includes the db.jar it too will be reloaded each time your code is reloaded. This causes exceptions as the native library can't be loaded more than once and there is no way to unload native code. The solution is to place the db.jar in $TOMCAT_HOME/common/lib and let Tomcat load that library once at start time rather than putting it into the WAR that gets reloaded over and over.

Copyright (c) 1996-2003 Sleepycat Software, Inc. - All rights reserved.