Java Sample Code to connect to Secure Hive Server 2 (Direct and via Knox)
The following link has some sample code to connect to a secure Hive Server2 via the default connection string and via knox.
https://github.com/vspw/hiveJDBC
It uses the following Jar files:-
| commons-configuration-xx.jar (UGI set configurations and metrics) |
| commons-logging-xx.jar (*Not mandatory) |
| hadoop-auth-xx.jar |
| hadoop-common-xx.jar (UGI stuff, hadoop configurations) |
| hive-jdbc-1.2xx-standalone.jar |
| log4j-xx-api-xx.jar (for log4j) |
| log4j-api-xx.jar (for log4j) |
| log4j-core.xx.jar (for log4j) |
| xercesImpl-xx.jar |
It also reads a bunch of properties like "keytabLocationWindows", "jdbcConnStringDirect", "hiveQuery" etc. from a properties file and logging is enabled with log4j2.xml.
The class: "HiveJDBCKnox" , has some instructions to make knox connectivity work on windows platform as well.

