Downloading the Beeline CLI tarball

Download the Beeline CLI tarball from Cloudera Data Warehouse (CDW) to your local system and use the Beeline client to connect to a Hive Virtual Warehouse and run queries. The archive file contains all the dependent JARs and libraries that are required to run the Beeline script.

From the Cloudera Management Console user profile, note the Workload User Name and Workload Password.
  1. Log in to the CDP web interface and navigate to the Data Warehouse service.
  2. In the Overview page of the Data Warehouse service, click See More in the Resources and Downloads tile.
  3. Select Beeline CLI and click to download the file.
  4. Save the apache-hive-beeline-x.x.xxxx.tar.gz file in your local system and extract the tarball.
  5. In the Data Warehouse service Overview page, for the Virtual Warehouse you want to connect to the client, click and select Copy JDBC URL.
  6. Paste the copied JDBC URL in a text file, to be used in later steps.
  7. Open a terminal window and go to the folder where the tarball is extracted to start Beeline.
    This starts an interactive Beeline shell where you can connect to Hive and run SQL queries.
  8. Run the connect command to connect to Hive using the JDBC URL that you copied earlier.
    beeline> !connect [***JDBC URL***]
    Connecting to jdbc:hive2://<your-virtual-warehouse>.<your-environment>.<>/default;transportMode=http;httpPath=cliservice;ssl=true;retries=3
  9. Enter the Workload User Name and Workload Password when you are prompted for the user credentials.
    Enter username for jdbc:hive2://<your-virtual-warehouse>.<your-environment>.<>/default: [***WORKLOAD USERNAME***]
    Enter password for jdbc:hive2://<your-virtual-warehouse>.<your-environment>.<>/default: [***WORKLOAD PASSWORD***]
    Connected to: Apache Hive (version 3.1.2000.
    Driver: Hive JDBC (version 3.1.2000.
    Transaction isolation: TRANSACTION_REPEATABLE_READ
  10. To verify if you are connected to HiveServer2 on the Virtual Warehouse, run the following SQL command:
    INFO : Compiling command(queryId=hive_20200214014428_182d2b63-a510-421f-8bbc-65a4ae24d1d6): show tables
    INFO : Semantic Analysis Completed (retrial = false)
    INFO : Completed compiling command(queryId=hive_20200214014428_182d2b63-a510-421f-8bbc-65a4ae24d1d6); Time taken: 0.054 seconds
    INFO : Executing command(queryId=hive_20200214014428_182d2b63-a510-421f-8bbc-65a4ae24d1d6): show tables
    INFO : Starting task [Stage-0:DDL] in serial mode
    INFO : Completed executing command(queryId=hive_20200214014428_182d2b63-a510-421f-8bbc-65a4ae24d1d6); Time taken: 0.018 seconds
    INFO : OK
    No rows selected (0.311 seconds)