Using HiveServer2 clients
Once we started HiveServer2, we could connect to the server with different clients as per our requirements and run Hive Query Language (HiveQL). The different client includes beeline, JDBC, ODBC, and so on. We will be going through each client in detail.
Getting ready
This recipe requires Hive installed as described in the Installing Hive recipe of Chapter 1, Developing Hive. For connecting with HiveServer2 using a client, you must run HiveServer2, as described in the Introducing HiveServer2 recipe in this chapter.
How to do it…
There are multiple ways of connecting with HiveServer2, as described in the following sections.
Beeline
Beeline is a shell client that could be executed from the terminal by running the following command:
beeline
Once you enter the beeline
shell, you can make a connection to the HiveServer2 service as a user using the following command:
!connect jdbc:hive2://localhost:10000 scott tiger org.apache.hive.jdbc.HiveDriver
If the connection is...