/** Test exclusive creation. */
  @Test
  public void testExclusive() throws Throwable {

    try {
      EnvironmentConfig envConfig = TestUtils.initEnvConfig();

      /*
       * Make sure that the database keeps its own copy of the
       * configuration object.
       */
      envConfig.setAllowCreate(true);
      env = create(envHome, envConfig);
      DatabaseConfig dbConfig = new DatabaseConfig();
      dbConfig.setAllowCreate(true);
      dbConfig.setExclusiveCreate(true);

      /* Should succeed and create the database. */
      Database dbA = env.openDatabase(null, "foo", dbConfig);
      dbA.close();

      /* Should not succeed, because the database exists. */
      try {
        env.openDatabase(null, "foo", dbConfig);
        fail("Database already exists");
      } catch (DatabaseException e) {
      }
      close(env);
    } catch (Throwable t) {
      t.printStackTrace();
      throw t;
    }
  }