org.apache.hive.jdbc

## Class Utils

- java.lang.Object
- - org.apache.hive.jdbc.Utils

    public class Utils
    extends Object

### Nested Class Summary

Nested Classes
`static class` `Utils.JdbcConnectionParams`

### Field Summary

Fields
`static String` `DEFAULT_DATABASE` Hive's default database name
`static String` `DEFAULT_PORT` If host is provided, without a port.
`static org.apache.commons.logging.Log` `LOG`
`static String` `URL_PREFIX` The required prefix for the connection URL.

### Constructor Summary

Constructors
Constructor and Description
`Utils()`

### Method Summary

Methods
`static Utils.JdbcConnectionParams` `parseURL(String uri)` Parse JDBC connection URL The new format of the URL is: jdbc:hive2://<host1>:<port1>,<host2>:<port2>/dbName;sess_var_list?hive_conf_list#hive_var_list where the optional sess, conf and var lists are semicolon separated <key>=<val> pairs.
`static void` `verifySuccess(TStatus status)`
`static void` `verifySuccess(TStatus status, boolean withInfo)`
`static void` `verifySuccessWithInfo(TStatus status)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### LOG

    public static final org.apache.commons.logging.Log LOG

#### URL_PREFIX

    public static final String URL_PREFIX

The required prefix for the connection URL.

See Also:
  Constant Field Values

#### DEFAULT_PORT

    public static final String DEFAULT_PORT

If host is provided, without a port.

See Also:
  Constant Field Values

#### DEFAULT_DATABASE

    public static final String DEFAULT_DATABASE

Hive's default database name

See Also:
  Constant Field Values

### Constructor Detail

#### Utils

    public Utils()

### Method Detail

#### verifySuccessWithInfo

    public static void verifySuccessWithInfo(TStatus status)
                                      throws SQLException

Throws:
  `SQLException`

#### verifySuccess

    public static void verifySuccess(TStatus status)
                              throws SQLException

Throws:
  `SQLException`

#### verifySuccess

    public static void verifySuccess(TStatus status,
                     boolean withInfo)
                              throws SQLException

Throws:
  `SQLException`

#### parseURL

    public static Utils.JdbcConnectionParams parseURL(String uri)
                                               throws JdbcUriParseException,
                                                      SQLException,
                                                      ZooKeeperHiveClientException

Parse JDBC connection URL The new format of the URL is: jdbc:hive2://<host1>:<port1>,<host2>:<port2>/dbName;sess_var_list?hive_conf_list#hive_var_list where the optional sess, conf and var lists are semicolon separated <key>=<val> pairs. For utilizing dynamic service discovery with HiveServer2 multiple comma separated host:port pairs can be specified as shown above. The JDBC driver resolves the list of uris and picks a specific server instance to connect to. Currently, dynamic service discovery using ZooKeeper is supported, in which case the host:port pairs represent a ZooKeeper ensemble. As before, if the host/port is not specified, it the driver runs an embedded hive. examples - jdbc:hive2://ubuntu:11000/db2?hive.cli.conf.printheader=true;hive.exec.mode.local.auto.inputbytes.max=9999#stab=salesTable;icol=customerID jdbc:hive2://?hive.cli.conf.printheader=true;hive.exec.mode.local.auto.inputbytes.max=9999#stab=salesTable;icol=customerID jdbc:hive2://ubuntu:11000/db2;user=foo;password=bar Connect to http://server:10001/hs2, with specified basicAuth credentials and initial database: jdbc:hive2://server:10001/db;user=foo;password=bar?hive.server2.transport.mode=http;hive.server2.thrift.http.path=hs2

Parameters:
  `uri` -
Returns:
Throws:
  `SQLException`
  `JdbcUriParseException`
  `ZooKeeperHiveClientException`