This is the documentation for Cloudera 5.5.x. Documentation for other versions is available at Cloudera Documentation.

Installing the Hive JDBC Driver on Clients

If you want to install only the JDBC on your Hive clients, proceed as follows.

The CDH 5.2 Hive JDBC driver is not wire-compatible with the CDH 5.1 version of HiveServer2. Make sure you upgrade Hive clients and all other Hive hosts in tandem: the server first, and then the clients.

  1. Install the package (it is included in CDH packaging). Use one of the following commands, depending on the target operating system:
    • On Red-Hat-compatible systems:
      $ sudo yum install hive-jdbc
    • On SLES systems:
      $ sudo zypper install hive-jdbc
    • On Ubuntu or Debian systems:
      $ sudo apt-get install hive-jdbc
  2. Add /usr/lib/hive/lib/*.jar and /usr/lib/hadoop/*.jar to your classpath.

You are now ready to run your JDBC client. HiveServer2 has a new JDBC driver that supports both embedded and remote access to HiveServer2. The connection URLs are also different from those in previous versions of Hive.

For more information see the HiveServer2 Client document.

Connection URLs

The HiveServer2 connection URL has the following format:

  • <host1>:<port1>,<host2>:<port2> is a server instance or a comma separated list of server instances to connect to (if dynamic service discovery is enabled). If no server is mentioned here, the embedded server will be used.
  • dbName is the name of the initial database.
  • sess_var_list is a semicolon separated list of key=value pairs of session variables. For example, user=foo;password=bar.
  • hive_conf_list is a semicolon separated list of key=value pairs of Hive configuration variables for this session. For example, hive.server2.transport.mode=http;hive.server2.thrift.http.path=hs2.
  • hive_var_list is a semicolon separated list of key=value pairs of Hive variables for this session.
Connection URLs for Remote or Embedded Mode: For remote or embedded access, the JDBC Driver class is org.apache.hive.jdbc.HiveDriver.
  • For a remote server, the URL format is jdbc:hive2://<host>:<port>/<db>. The default HiveServer2 port is 10000).
  • For an embedded server, the URL format is jdbc:hive2:// (no host or port).
Connection URLs in HTTP Mode:
where <http_endpoint> is the corresponding HTTP endpoint configured in hive-site.xml. The default value for the endpoint is cliservice. The default port for HTTP transport mode is 10001.
Connection URLs with SSL Enabled:
  • <trust_store_path> is the path where client's truststore file is located.
  • <trust_store_password> is the password to access the truststore.
In HTTP mode with SSL enabled, the URL is of the format:
Page generated November 23, 2015.