private void openEnvironment(File file) throws DatabaseInitException {
    EnvironmentConfig envConfig = new EnvironmentConfig();
    envConfig.setCachePercent(30);
    envConfig.setAllowCreate(true);
    envConfig.setTransactional(true);
    envConfig.setTxnTimeout(10, TimeUnit.SECONDS);
    envConfig.setLockTimeout(2000, TimeUnit.MILLISECONDS);
    try {
      environment = new Environment(file, envConfig);
      transactionConfig = new TransactionConfig();
      transactionConfig.setReadCommitted(true);

      cursorConfig = new CursorConfig();
      cursorConfig.setReadCommitted(true);
    } catch (EnvironmentLockedException e) {
      String message =
          "Environment locked exception. Another process is using the same database, or the current user has no write access (database location: \""
              + file.getAbsolutePath()
              + "\")";
      throw new DatabaseInitException(message);
    } catch (DatabaseException e) {
      String message = "A database initialisation error has occured (" + e.getMessage() + ")";
      throw new DatabaseInitException(message);
    }
  }