SquirrelSQL

SquirrelSQL is a simple JDBC client which executes SQL queries against many different relational databases. Here's how to add the CDAP JDBC driver inside SquirrelSQL.

  1. Open the Drivers pane, located on the far left corner of SquirrelSQL.

  2. Click the + icon of the Drivers pane.

    _images/squirrel_drivers.png
  3. Add a new Driver by entering a Name, such as CDAP Driver. The Example URL is of the form jdbc:cdap://<host>:11015?auth.token=<token>. The Website URL can be left blank. In the Class Name field, enter co.cask.cdap.explore.jdbc.ExploreDriver. Click on the Extra Class Path tab, then on Add, and put the path to co.cask.cdap.cdap-explore-jdbc-<version>.jar.

    _images/squirrel_add_driver.png
  4. Click on OK. You should now see Cask CDAP Driver in the list of drivers from the Drivers pane of SquirrelSQL.

  5. We can now create an alias to connect to a running instance of CDAP. Open the Aliases pane, and click on the + icon to create a new alias.

  6. In this example, we are going to connect to a CDAP Sandbox. The name of our alias will be CDAP Sandbox. Select the CDAP Driver in the list of available drivers. Our URL will be jdbc:cdap://localhost:11015. Our CDAP Sandbox instance does not require an authentication token, but if yours requires one, HTML-encode your token and pass it as a parameter of the URL. User Name and Password are left blank.

    _images/squirrel_add_alias.png
  7. Click on OK. CDAP Sandbox is now added to the list of aliases.

  8. A popup asks you to connect to your newly-added alias. Click on Connect, and SquirrelSQL will retrieve information about your running CDAP datasets.

  9. To execute a SQL query on your CDAP datasets, go to the SQL tab, enter a query in the center field, and click on the "running man" icon on top of the tab. Your results will show in the bottom half of the SquirrelSQL main view.

    _images/squirrel_sql_query.png