3
votes

I'm using the Impala JDBC driver (or I guess it's actually the Hive Server 2 JDBC driver). I have a view created in another database -- let's call it "store55".

Let's say my view is defined as follows:

CREATE VIEW good_customers AS 
SELECT * from customers WHERE good = true;

When I try to query this view using JDBC as follow:

SELECT * FROM store55.good_customers LIMIT 10

I get an error such as:

java.sql.SQLException: AnalysisException: Table does not exist: default.customers

Ideally, I'd like to specify the database name somewhere in the JDBC URL or as a parameter but when I try to use this JDBC url, I still get the same error:

jdbc:hive2://<host>:<port>/store55;auth=noSasl

Doe the Hive2 JDBC driver just ignore the database part of the URL and assume all queries are executed against the default database?

The only way I was able to have the queries return is to change the view definition itself to include the database name:

CREATE VIEW good_customers AS 
SELECT * from store55.customers WHERE good = true;

However, I'd like to keep the view definition free of database names.

Thanks!

2
Have you found out ? If yes, please post an answer - Tony

2 Answers

0
votes

You might want to specify in JDBC the "use database xxxxx;" statement.

Also, if you are already using the database try "invalidate metadata" statement.

-1
votes

The URL is jdbc:hive2://:/store55;auth=noSasl correct

Can you run few diagnostics such as:

  1. SHOW TABLES - to ensure that the view is created in store55

Are you using the USE DATABASE command in the DDL's