Support Questions

Find answers, ask questions, and share your expertise

Uppercase hive DB name

avatar
Master Guru

Hey Guys,

Is it possible to create hive database name in UPPERCASE ?

hive> create database KULDEEP;
hive> show databases; 
OK 
default 
kuldeep 
test 
Time taken: 0.464 seconds, Fetched: 3 row(s)
1 ACCEPTED SOLUTION

avatar
Master Guru

@Rajesh Balamohan

helped me to find answer of this question.

As per code it always converts given database name in lowercase format

Answer of this questions is - Database names in hive will always be in lowecase.

https://svn.apache.org/repos/asf/hive/trunk/metast...

 @Override
  public void createDatabase(Database db) throws InvalidObjectException, MetaException {
    boolean commited = false;
    MDatabase mdb = new MDatabase();
    mdb.setName(db.getName().toLowerCase());
    mdb.setLocationUri(db.getLocationUri());
    mdb.setDescription(db.getDescription());
    mdb.setParameters(db.getParameters());
    mdb.setOwnerName(db.getOwnerName());
    PrincipalType ownerType = db.getOwnerType();
    mdb.setOwnerType((null == ownerType ? PrincipalType.USER.name() : ownerType.name()));
    try {
      openTransaction();
      pm.makePersistent(mdb);
      commited = commitTransaction();
    } finally {
      if (!commited) {
        rollbackTransaction();
      }
    }
  }

View solution in original post

4 REPLIES 4

avatar

As far as I can tell it is not possible. See this Jira https://issues.apache.org/jira/browse/HIVE-7689

avatar
Master Mentor
@Kuldeep Kulkarni

Not possible as of now. I just ran few tests but nothing.

avatar
Master Guru

avatar
Master Guru

@Rajesh Balamohan

helped me to find answer of this question.

As per code it always converts given database name in lowercase format

Answer of this questions is - Database names in hive will always be in lowecase.

https://svn.apache.org/repos/asf/hive/trunk/metast...

 @Override
  public void createDatabase(Database db) throws InvalidObjectException, MetaException {
    boolean commited = false;
    MDatabase mdb = new MDatabase();
    mdb.setName(db.getName().toLowerCase());
    mdb.setLocationUri(db.getLocationUri());
    mdb.setDescription(db.getDescription());
    mdb.setParameters(db.getParameters());
    mdb.setOwnerName(db.getOwnerName());
    PrincipalType ownerType = db.getOwnerType();
    mdb.setOwnerType((null == ownerType ? PrincipalType.USER.name() : ownerType.name()));
    try {
      openTransaction();
      pm.makePersistent(mdb);
      commited = commitTransaction();
    } finally {
      if (!commited) {
        rollbackTransaction();
      }
    }
  }