@Override
  public void createDatabase(Database db) throws InvalidObjectException, MetaException {
    boolean commited = false;
    MDatabase mdb = new MDatabase();
    assert db.getCatalogName() != null;
    mdb.setCatalogName(normalizeIdentifier(db.getCatalogName()));
    assert mdb.getCatalogName() != null;
    mdb.setName(db.getName().toLowerCase());
    mdb.setLocationUri(db.getLocationUri());
    mdb.setManagedLocationUri(db.getManagedLocationUri());
    mdb.setDescription(db.getDescription());
    mdb.setParameters(db.getParameters());
    mdb.setOwnerName(db.getOwnerName());
    mdb.setDataConnectorName(db.getConnector_name());
    mdb.setRemoteDatabaseName(db.getRemote_dbname());
    if (db.getType() == null) {
      mdb.setType(DatabaseType.NATIVE.name());
    } else {
      mdb.setType(db.getType().name());
    }
    PrincipalType ownerType = db.getOwnerType();
    mdb.setOwnerType((null == ownerType ? PrincipalType.USER.name() : ownerType.name()));
    mdb.setCreateTime(db.getCreateTime());
    try {
      openTransaction();
      pm.makePersistent(mdb);
      commited = commitTransaction();
    } finally {
      rollbackAndCleanup(commited, null);
    }
  }
Rolls back the current transaction if it is active
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java