CDAP JDBC Driver

Overview

CDAP provides a JDBC driver to make integrations with external programs and third-party BI (business intelligence) tools easier.

The JDBC driver is a JAR that is bundled with the CDAP Sandbox. You can find it in the libexec directory of your Sandbox installation at:

libexec/io.cdap.cdap.cdap-explore-jdbc-<version>.jar

If you don't have a CDAP Sandbox and only want to connect to an existing instance of CDAP, you can download the CDAP JDBC driver from this link. Go to the directory matching the version of your running CDAP instance, and download the file with the matching version number:

cdap-explore-jdbc-<version>.jar

Using the CDAP JDBC Driver in your Java Code

To use CDAP JDBC driver in your code, place cdap-jdbc-driver.jar in the classpath of your application. If you are using Maven, you can simply add a dependency in your file pom.xml:

<dependencies> ... <dependency> <groupId>io.cdap.cdap</groupId> <artifactId>cdap-explore-jdbc</artifactId> <version><!-- Version of CDAP you want the JDBC driver to query --></version> </dependency> ... </dependencies>

Here is a snippet of Java code that uses the CDAP JDBC driver to connect to a running instance of CDAP, and executes a query over a CDAP dataset mydataset:

Here are the parameters that can be used in the connection URL:

  • namespace: CDAP namespace to run in

  • auth.token: authentication token for the connection

  • ssl.enabled: boolean; whether SSL is enabled or not

  • verify.ssl.cert: boolean; false to suspend certificate checks and allow self-signed certificates

  • fetch.size: int; number of rows to fetch at a time from the database cursor. Defaults to 1000. 0 means no limit.

JDBC drivers are a standard in the Java ecosystem, with many resources about them available.

Created in 2020 by Google Inc.