Package org.apache.hive.jdbc.Utils

Examples of org.apache.hive.jdbc.Utils.JdbcConnectionParams


  @Test
  public void testParseUrlHttpMode() throws SQLException {
    HiveDriver driver = new HiveDriver();
    for (String[] testValues : HTTP_URL_PROPERTIES) {
      JdbcConnectionParams params = Utils.parseURL(testValues[0]);
      assertEquals(params.getHost(), testValues[1]);
      assertEquals(params.getPort(), Integer.parseInt(testValues[2]));
      assertEquals(params.getDbName(), testValues[3]);
      assertEquals(params.getHiveConfs().get("hive.server2.transport.mode"), testValues[4]);
      assertEquals(params.getHiveConfs().get("hive.server2.thrift.http.path"), testValues[5]);
    }
  }
View Full Code Here


  @Test
  public void testParseUrlHttpMode() throws SQLException {
    new HiveDriver();
    for (String[] testValues : HTTP_URL_PROPERTIES) {
      JdbcConnectionParams params = Utils.parseURL(testValues[0]);
      assertEquals(params.getHost(), testValues[1]);
      assertEquals(params.getPort(), Integer.parseInt(testValues[2]));
      assertEquals(params.getDbName(), testValues[3]);
      assertEquals(params.getHiveConfs().get("hive.server2.transport.mode"), testValues[4]);
      assertEquals(params.getHiveConfs().get("hive.server2.thrift.http.path"), testValues[5]);
    }
  }
View Full Code Here

    if (url == null || !url.startsWith(Utils.URL_PREFIX)) {
      throw new SQLException("Invalid connection url: " + url);
    }

    JdbcConnectionParams params = Utils.parseURL(url);
    String host = params.getHost();
    if (host == null){
      host = "";
    }
    String port = Integer.toString(params.getPort());
    if(host.equals("")){
      port = "";
    }
    else if(port.equals("0")){
      port = Utils.DEFAULT_PORT;
    }
    String db = params.getDbName();
    urlProps.put(HOST_PROPERTY_KEY, host);
    urlProps.put(PORT_PROPERTY_KEY, port);
    urlProps.put(DBNAME_PROPERTY_KEY, db);

    return urlProps;
View Full Code Here

    if (url == null || !url.startsWith(Utils.URL_PREFIX)) {
      throw new SQLException("Invalid connection url: " + url);
    }

    JdbcConnectionParams params = null;
    try {
      params = Utils.parseURL(url);
    } catch (ZooKeeperHiveClientException e) {
      throw new SQLException(e);
    }
    String host = params.getHost();
    if (host == null){
      host = "";
    }
    String port = Integer.toString(params.getPort());
    if(host.equals("")){
      port = "";
    }
    else if(port.equals("0") || port.equals("-1")){
      port = Utils.DEFAULT_PORT;
    }
    String db = params.getDbName();
    urlProps.put(HOST_PROPERTY_KEY, host);
    urlProps.put(PORT_PROPERTY_KEY, port);
    urlProps.put(DBNAME_PROPERTY_KEY, db);

    return urlProps;
View Full Code Here

@Test
public void testParseUrlHttpMode() throws SQLException, JdbcUriParseException,
    ZooKeeperHiveClientException {
  new HiveDriver();
  for (String[] testValues : HTTP_URL_PROPERTIES) {
    JdbcConnectionParams params = Utils.parseURL(testValues[0]);
    assertEquals(params.getHost(), testValues[1]);
    assertEquals(params.getPort(), Integer.parseInt(testValues[2]));
    assertEquals(params.getDbName(), testValues[3]);
    assertEquals(params.getSessionVars().get("transportMode"), testValues[4]);
    assertEquals(params.getSessionVars().get("httpPath"), testValues[5]);
  }
}
View Full Code Here

TOP

Related Classes of org.apache.hive.jdbc.Utils.JdbcConnectionParams

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.