Database Properties

You can set database properties using the DatabaseConfig class. For each of the properties that you can set, there is a corresponding getter method. Also, you can always retrieve the DatabaseConfig object used by your database using the Database.getConfig() method.

There are a large number of properties that you can set using this class (see the javadoc for a complete listing). From the perspective of this manual, some of the more interesting properties are:

In addition to these, there are also methods that allow you to control the IO stream used for error reporting purposes. These are described later in this manual.

For example:

package db.GettingStarted;

import com.sleepycat.db.Database;
import com.sleepycat.db.DatabaseConfig;
import com.sleepycat.db.DatabaseException;
import com.sleepycat.db.DatabaseType;


Database myDatabase = null;
try {
    DatabaseConfig dbConfig = new DatabaseConfig();
    myDatabase = new Database("sampleDatabase.db",
} catch (DatabaseException dbe) {
    // Exception handling goes here.
} catch (FileNotFoundException fnfe) {
    // Exception handling goes here