Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

HiveServer2 supports a new command shell Beeline that works with HiveServer2. Its a JDBC client that is based on SQLLine CLI (http://sqlline.sourceforge.net/). There’s an detailed documentation of the SQLLine which is applicable to Beeline as well. The Beeline shell works in the both embedded as well as remote mode. In the embedded mode, it runs an embedded Hive (similar to Hive CLI) where are remote mode is for connecting to a separate HiveServer2 process over Thrift.

Example -

Code Block

% bin/beeline
Hive version 0.11.0-SNAPSHOT by Apache
beeline> !connect jdbc:hive2://localhost:10000 scott tiger org.apache.hive.jdbc.HiveDriver
!connect jdbc:hive2://localhost:10000 scott tiger org.apache.hive.jdbc.HiveDriver
Connecting to jdbc:hive2://localhost:10000
Connected to: Hive (version 0.10.0)
Driver: Hive (version 0.10.0-SNAPSHOT)
Transaction isolation: TRANSACTION_REPEATABLE_READ
0: jdbc:hive2://localhost:10000> show tables;
show tables;
+-------------------+
|     tab_name      |
+-------------------+
| primitives        |
| src               |
| src1              |
| src_json          |
| src_sequencefile  |
| src_thrift        |
| srcbucket         |
| srcbucket2        |
| srcpart           |
+-------------------+
9 rows selected (1.079 seconds)

JDBC

HiveServere2 has a new JDBC driver. It supports both embedded and remote access to HiveServer2.
The JDBC connection URL format has prefix is jdbc:hive2:// and the Driver class is org.apache.hive.jdbc.HiveDriver. Note that this is different from the old hiveserver. For remote server, the URL format is jdbc:hive2://<host>:<port>/<db> (default port for HiveServer2 is 10000). For embedded server, the URL format is jdbc:hive2:// (no host or port).

...