Beeline is a JDBC client tool which is used to connect to HiveServer2 or HiveServer2Interactive(LLAP). Beeline, which connects to HiveServer2 and requires access to only one .jar file: hive-jdbc-<version>-standalone.jar
Hortonworks recommends using HiveServer2 and a JDBC client (such as Beeline) as the primary way to access Hive. This approach uses SQL standard-based authorization or Ranger-based authorization. However, some users may wish to access Hive data from other applications, such as Pig. For these use cases, use the Hive CLI and storage-based authorization.
Connecting to Hive with Beeline
The following examples demonstrate how to use Beeline to connect to Hive for all possible variations of these modes.
Embedded Client
Use the following syntax to connect to Hive from Beeline in embedded mode:
!connect jdbc:hive2://
Remote Client with HiveServer2 TCP Transport Mode and SASL Authentication
Use the following syntax to connect to HiveServer2 in TCP mode from a remote Beeline client:
The default port for HiveServer2 in TCP mode is 10000, and db is the name of the database to which you want to connect.
Connecting to HiveServer2 using Zookeeper Discovery Mode
Note: You can also find the below HiveServer2 JDBC URL from Ambari from Hive -> Summary page. To copy the JDBC URL, you can use the copy to clipboard icon next to the URL
Observe the / after the <ZOOKEEPER QUORUM> in each string below