# Package org.apache.solr.client.solrj.io.sql

JDBC Driver Package Sample usage

See: Description

- Class Summary
  Class | Description
  --- | ---
  DriverImpl | Get a Connection with with a url and properties.

## Package org.apache.solr.client.solrj.io.sql 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(rs.next()) {
        String a = rs.getString("a");
        double sumB = rs.getString("sum(b)");
      }
     } finally {
      rs.close();
      stmt.close();
      con.close();
     }

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".

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.