DbEnv env = new DbEnv(0);
env.open(dir, envFlags, 0);
// create the application and run a transaction
HelloDatabaseWorld worker = new HelloDatabaseWorld(env);
TransactionRunner runner = new TransactionRunner(env);
try {
// open and access the database within a transaction
runner.run(worker);
} finally {
// close the database outside the transaction
worker.close();
}
}