Skip navigation links


JDBC Driver Package Sample usage

See: Description

Package Description

JDBC Driver Package Sample usage
 Connection con = null;
 Statement stmt = null;
 ResultSet rs = null;

 try {
  con = DriverManager.getConnection("jdbc:solr://zkHost:port?collection=collection&aggregationMode=map_reduce");
  stmt = con.createStatement();
  rs = stmt.executeQuery("select a, sum(b) from tablex group by a");
  while( {
    String a = rs.getString("a");
    double sumB = rs.getString("sum(b)");
 } finally {
Connection properties can also be passed in using a Properties object. The collection parameter is mandatory and should point to a SolrCloud collection that is configured with the /sql request handler. The aggregationMode parameter is optional. It can be used to switch between Map/Reduce (map_reduce) or the JSON Facet API (facet) for group by aggregations. The default is "facet".
Skip navigation links