JDBC with Apache Zeppelin

The Solr JDBC driver can support Apache Zeppelin.

A Solr-specific interpreter is available as an alternative to using the JDBC driver. See the section Zeppelin-Solr Interpreter for details.

If you choose to use Zeppelin’s JDBC interpreter instead, you must use Zeppelin 0.6.0 or greater to get JDBC support.

To use Apache Zeppelin with Solr, you will need to create a JDBC interpreter for Solr. This will add SolrJ to the interpreter classpath. Once the interpreter has been created, you can create a notebook to issue queries. The Zeppelin JDBC interpreter documentation provides additional information about JDBC prefixes and other features.

Create the Apache Solr JDBC Interpreter

image
Figure 1. Click "Interpreter" in the top navigation
image
Figure 2. Click "Create"
image
Figure 3. Enter information about your Solr installation

For most installations, Apache Zeppelin configures PostgreSQL as the JDBC interpreter default driver. The default driver can either be replaced by the Solr driver as outlined above or you can add a separate JDBC interpreter prefix as outlined in the Apache Zeppelin JDBC interpreter documentation.

Create a Notebook

image
Figure 4. Click Notebook → Create new note
image
Figure 5. Provide a name and click "Create Note"

JDBC Interpreter Copy Sheet

To facilitate easy copying the parameters mentioned in the screenshots, here is a consolidated list of the parameters:

Name : Solr
Interpreter : jdbc
default.url : jdbc:solr://SOLR_ZK_CONNECTION_STRING?collection=
default.driver : org.apache.solr.client.solrj.io.sql.DriverImpl
default.user : solr
dependency : org.apache.solr:solr-solrj:9.6.1

Query with the Notebook

For some notebooks, the JDBC interpreter will not be bound to the notebook by default. Instructions on how to bind the JDBC interpreter to a notebook are available here.

image
Figure 6. Results of Solr query

The below code block assumes that the Apache Solr driver is set up as the default JDBC interpreter driver. If that is not the case, instructions for using a different prefix is available here.

%jdbc
select fielda, fieldb, from test limit 10