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.

The database properties that you can set are:

For example:

package je.gettingStarted;

import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Database;
import com.sleepycat.je.DatabaseConfig;

...
// Environment open omitted for brevity
...

Database myDatabase = null;
try {
    DatabaseConfig dbConfig = new DatabaseConfig();
    dbConfig.setAllowCreate(true);
    dbConfig.setSortedDuplicates(true);
    myDatabase = 
        myDbEnv.openDatabase(null, 
                             "sampleDatabase", 
                             dbConfig); 
} catch (DatabaseException dbe) {
    // Exception handling goes here.
}