Specifiy "use database" in Hadoop Hive HQL query

0

We have multiple databases defined in Hive. In Hive command line mode or a script I can issue "use database" followed by a query (example below). When I try to specify the use database in the report query dialog I get an errror. Also I replaced /defualt at the end of JDBC connection string with my database name and it did not like that. Is there a method to specify a database name?

 

use test;

select * from test_table;

bradley.harris's picture
Joined: Nov 30 2012 - 5:55am
Last seen: 6 years 3 months ago
we are specifying Database name at the time of connection.
anvy.varghese - 6 years 3 months ago
If I use the connection string below I connect to the default database. jdbc:hive://hdpencwy0001:10000/default If I point to the "test" database (jdbc:hive://hdpencwy0001:10000/test)I receive the following error: Error: net.sf.jasperreports.engine.JRException: Invalid Hive JDBC url:jdbc:hive://hdpencwy0001:10000/test Verified database and table with data exists. Using vesrion 5.
bradley.harris - 6 years 3 months ago
I am also facing same issue. I am just configuring hive with mysql instead of derby as mentioned in http://www.javacodegeeks.com/2012/02/big-data-analytics-with-hive-and.html. Will try and let you know.
anilguptakgp - 6 years 3 months ago
show 1 more...

Which version of iReport are you using?

marianol - 5 years 6 months ago

1 Answer:

0
Unfortuately the JDBC Hive driver only allows connecting to the "default" database (this is not a Jaspersoft limitation but a JDBC Hive driver one) - so to get around this just use the table aliasing in dot notation, like this: select * from store.sales Connects to database store, table sales! This is the page that points out the limitation in Hadoop Hive JDBC driver: https://cwiki.apache.org/confluence/display/Hive/HiveClient#HiveClient-JDBC
ernestoo's picture
6976
Joined: Nov 29 2010 - 11:59am
Last seen: 1 year 5 months ago
Feedback
randomness