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.

HIVE metastore question

Solved Go to solution
Highlighted

HIVE metastore question

Master Collaborator

I am unable to import a table into HIVE , I am getting error "database doesn't exist" , googling Iam seeing people reporting that for Cloudera hive metastore needs to be set in "remote" mode. is there something I have to do in Horton works also?

can I use the "default" database that comes with the postgres Hive database or do I have to create a new one if I want to use HIVE?

below is the command I am giving and the error generated , I am not sure why is the command looking for a database called "PATRON" ?

sqoop import --connect "jdbc:oracle:thin:@(description=(address=(protocol=tcp)(host=patronQA)(port=1526))(connect_data=(service_name=patron)))" --username PATRON --password xxxx --table PATRON.TAB1 --split-by TAB1.ACCT_NUM --hive-import --create-hive-table

FAILED: SemanticException [Error 10072]: Database does not exist: PATRON

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: HIVE metastore question

@Sami Ahmad

You can use the "default" database in Hive without any issue. It is a fairly common approach.

The error you are seeing could be related to sqoop having access problems to the PATRON database in Oracle.

You can pass the --hive-table parameter to specify the name of the hive table into which you want to store the data.

https://sqoop.apache.org/docs/1.4.2/SqoopUserGuide.html#_literal_sqoop_create_hive_table_literal

Try adding "--hive-table default.tab1" to the command.

View solution in original post

6 REPLIES 6
Highlighted

Re: HIVE metastore question

@Sami Ahmad

You can use the "default" database in Hive without any issue. It is a fairly common approach.

The error you are seeing could be related to sqoop having access problems to the PATRON database in Oracle.

You can pass the --hive-table parameter to specify the name of the hive table into which you want to store the data.

https://sqoop.apache.org/docs/1.4.2/SqoopUserGuide.html#_literal_sqoop_create_hive_table_literal

Try adding "--hive-table default.tab1" to the command.

View solution in original post

Highlighted

Re: HIVE metastore question

Master Collaborator

oh yes that was it , it fixed the issue . but for my understanding , do we have to specify a local table always ?

Highlighted

Re: HIVE metastore question

@Sami Ahmad

When you say "local table", do you mean like "default.tab1"?

It's always a good idea to be as specific as possible about where you want to store the data in Hive. If you create a new database called "test" and you ran your original command, how would Sqoop and Hive know where to write the table? By specifying "default.tab1" or "test.tab1", you remove the unknowns.

Highlighted

Re: HIVE metastore question

Contributor

use -- --schema option to specify the additional information about the source schema

Highlighted

Re: HIVE metastore question

Master Collaborator

hi njay apparently the --schema option is not needed if I use the --hive-table option.

Highlighted

Re: HIVE metastore question

Contributor

ok Sami. it is better to provide schema so that we dont need to prefix the hive tables with 'default.'

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