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:

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

...

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