This document provides the information you need to know to start using Sclera’s embedded JDBC driver. The Sclera JDBC driver provides a standard API to manage and analyze your data from within a Java (more generally, JVM) application.

The embedded JDBC interface discussed in this document is an alternative to the server mode operation, where you first need to start a server, and the JDBC driver then interfaces with the server over a network connection. For more on the server mode operation, please refer to the Sclera server documentation.

This document is not a tutorial on how to use JDBC. JDBC is a Java standard; to get started on the basics, please refer to the the excellent tutorials and references provided by Oracle and PostgreSQL. Also, the Wikipedia entry on JDBC gives a quick overview.

Setting the CLASSPATH

To interface with Sclera, you need to include Sclera’s core library and the subscribed component JAR files in the CLASSPATH.

The bash script $SCLERA_HOME/bin/setclasspath.sh sets the required CLASSPATH; you need to source it into the current environment as (in bash):

source $SCLERA_HOME/bin/setclasspath.sh

In the above, $SCLERA_HOME is the directory where Sclera is installed.

JDBC URL

The JDBC driver is accessed through the URL jdbc:scleradb.

Supported Statements

The JDBC driver accepts all SQL statements supported by Sclera.

The queries return ResultSet objects, as required by the standard. However, the non-query statements (CREATE, INSERT, UPDATE and DELETE), which may be required by the standard to return the number of rows inserted or updated, may not return the correct number; this is because the underlying sources with non-SQL/JDBC interfaces (such as Apache HBase) may not return the required information.

Limitations

The JDBC support is partial (for instance, functions related to transaction processing and cursors are not supported, and only forward scans of resultsets are permitted). However, the supported API should suffice for most analytics applications, and for interfacing with most JDBC-compliant BI tools.

A complete list of limitations will be posted here soon.

Driver Type

The driver is compatible with JDBC type 4, in the sense that it is pure Java and is platform independent.

Connecting Sclera with your Existing Applications and Reporting Tools

The JDBC support also enables your existing applications and reporting tools to work with Sclera.

You need to set the classpath to make Sclera visible to the application. Note that Sclera’s SQL is largely compatible with PostgreSQL, so you can mention PostgreSQL when asked, but actually use Sclera’s JDBC driver.

Some applications and reporting tools can only accept (or generate) standard SQL. Such tools do not accept the SQL extensions needed to perform advanced analytics within your queries. To use such extensions, you need to define views within Sclera to perform the required analytics, and then have the application or reporting tool use these views in its queries.

The exact directions depend upon the specific application that you want to link. If you face a problem in linking your application to Sclera, please let us know by sending an email to support@scleradb.com, or filing a support ticket.


Related Documentation