in phoenix-queryserver/src/main/java/org/apache/phoenix/queryserver/server/PhoenixMetaFactoryImpl.java [84:110]
public String getConnectionUrl(Properties props, Configuration conf)
throws ClassNotFoundException, SQLException {
// read the hbase properties from the configuration
int port = getInt(HConstants.ZOOKEEPER_CLIENT_PORT, HConstants.DEFAULT_ZOOKEPER_CLIENT_PORT, props, conf);
// Build the ZK quorum server string with "server:clientport" list, separated by ','
final String server = getString(HConstants.ZOOKEEPER_QUORUM, HConstants.LOCALHOST, props, conf);
String znodeParent = getString(HConstants.ZOOKEEPER_ZNODE_PARENT, HConstants.DEFAULT_ZOOKEEPER_ZNODE_PARENT, props, conf);
String url = getUrl(server, port, znodeParent);
if (url.endsWith(JDBC_PROTOCOL_TERMINATOR + "")) {
url = url.substring(0, url.length() - 1);
}
// Mainly for testing to tack on the test=true part to ensure driver is found on server
String defaultExtraArgs =
conf != null
? conf.get(QueryServerProperties.EXTRA_JDBC_ARGUMENTS_ATTRIB,
QueryServerOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS)
: QueryServerOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS;
// If props doesn't have a default for extra args then use the extra args in conf as default
String extraArgs =
props.getProperty(QueryServerProperties.EXTRA_JDBC_ARGUMENTS_ATTRIB, defaultExtraArgs);
if (extraArgs.length() > 0) {
url += JDBC_PROTOCOL_TERMINATOR + extraArgs + JDBC_PROTOCOL_TERMINATOR;
} else {
url += JDBC_PROTOCOL_TERMINATOR;
}
return url;
}