Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Uppercase hive DB name

Solved Go to solution

Uppercase hive DB name

Super 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

Accepted Solutions
Highlighted

Re: Uppercase hive DB name

Super 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
Highlighted

Re: Uppercase hive DB name

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

Highlighted

Re: Uppercase hive DB name

@Kuldeep Kulkarni

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

Highlighted

Re: Uppercase hive DB name

Super Guru
Highlighted

Re: Uppercase hive DB name

Super 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

Don't have an account?
Coming from Hortonworks? Activate your account here