As a Hive user who connects to HiveServer2 from a client, you need to know how to set
up the client for using HPL/SQL.
-
On the client end, download the latest version of the Hive JDBC driver from the
Cloudera Downloads page.
-
Install the driver on the client end.
Typically, you add the JAR file to the Libraries folder.
-
In CDP Public Cloud, in Cloudera Manager, navigate to tab, and copy the Hive Server endpoint.
-
Paste the copied JDBC URL into a text file.
jdbc:hive2://<host:port>/default;transportMode=http;httpPath=cliservice;ssl=true;retries=3
-
Append
mode=hplsql
to the end of the JDBC URL for connecting
to Hive from the client.
jdbc:hive2://<host:port>/default;transportMode=http;httpPath=cliservice;ssl=true;retries=3;mode=hplsql
-
On the client end, use the JDBC URL in Beeline to connect to Hive and enable
HPL/SQL.
beeline -n <csso_username> -p <password> -u
"jdbc:hive2://<host:port>/default;transportMode=http;httpPath=cliservice;ssl=true;retries=3;mode=hplsql"
At the Hive prompt, you can run HPL/SQL. You can use the forward slash (/) as
a statement delimiter because a HPL/SQL statement can have multiple rows
consisting of multiple SQL statements.
Set
hive.security.authorization.sqlstd.confwhitelist.append=QUERY_EXECUTOR
in Hive Service Advanced Configuration Snippet (Safety Valve) for
hive-site.xml before running HPL/SQL queries.