Support Questions

Find answers, ask questions, and share your expertise

Cannot connect to beeline

avatar
Expert Contributor

I am trying to connect beeline from client system but I am not able to...

 

Beeline version 0.10.0-cdh4.5.0 by Apache Hive
beeline> !connect jdbc:hive2://hostname.com:10000 org.apache.hadoop.hive.jdbc.HiveDriver
scan complete in 6ms
Connecting to jdbc:hive2://hostname.com:10000
Enter password for jdbc:hive2://hostname.com:10000: ********
Error: Invalid URL: jdbc:hive2://hostname.com:10000 (state=08S01,code=0)

 

Am I missing anything here...Please advice..

 

Em Jay
1 ACCEPTED SOLUTION

avatar
Expert Contributor
This solved my problem....I was using the wrong syntax. Below is the right one...
!connect jdbc:hive2://hostname:10000/default;principal=hive/hostname@PRINCIPAL.COM
username and password blank....

Thanks for helping me out zhang...
Em Jay

View solution in original post

38 REPLIES 38

avatar
Cloudera Employee

It seems you're using the wrong JDBC driver. For HiveServer2, the JDBC driver class is org.apache.hive.jdbc.HiveDriver.

avatar
Expert Contributor
I also tried using org.apache.hive.jdbc.HiveDriver but no luck

!connect jdbc:hive2://hostname:10000 org.apache.hive.jdbc.HiveDriver
scan complete in 6ms
Connecting to jdbc:hive2://hostname:10000
Enter password for jdbc:hive2://hostname:10000: ********
Error: Invalid URL: jdbc:hive2://hostname:10000 (state=08S01,code=0)
Em Jay

avatar
Expert Contributor
We are using thrift service to connect to our hive metastore...
For thrift, need to use a different URL ?
Em Jay

avatar
Cloudera Employee
I must be misunderstanding the issue. If you need to connect HiveServer2
via JDBC, then the URL given for beeline should be one that has
HiveServer2's hostname/port.

If you need to connect to MetaStore via thrift, then you need to give
MetaStore server's hostname and port number to your thrift client.

HiveServer2 server and MetaStore server are two different servers running
on different host/port.

avatar
Expert Contributor
Sorry for confusing you...
I need to connect to the hiveserver2 using beeline and create a database.
the URL would be jdbc:hive2://hiveserver2_hostname:10000 org.apache.hive.jdbc.HiveDriver ?
I tried this too, got the same error.
Em Jay

avatar
Expert Contributor
What would be the username and password that I need to supply while executing this command ?
Em Jay

avatar
Cloudera Employee
Those would be what you're given by the HiverServer2 admin. If your
HiverServer2 instance is running with the default, then just leave them
blank.

avatar
Expert Contributor
When I leave it blank it is asking me for the password. I am not sure which password to supply...
Em Jay

avatar
Cloudera Employee
Also leave it blank.