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;