Apache HBase Data Source

This article includes information about how to install the Apache HBase JDBC driver, how to connect to an Apache HBase database, and a list of the HBase data types that  supports. With the JDBC driver installed, the HBase data source is available as an option in the connection wizard when creating an API.
lac42
This article includes information about how to install the Apache HBase JDBC driver, how to connect to an Apache HBase database, and a list of the HBase data types that 
Layer7 Live API Creator
 supports. With the JDBC driver installed, the
HBase
data source is available as an option in the connection wizard when creating an API.
In this article:
Install the Apache HBase JDBC Driver
The self-contained, single-user version of 
Layer7 Live API Creator
 that is based on Jetty includes the Apache HBase JDBC driver. The JDBC driver is located in the 
%JETTY_HOME%/caliveapicreator/lib/ext
 directory. If you have installed this version of 
Layer7 Live API Creator
, no additional steps are required to install the JDBC driver.
If you have installed
Layer7 Live API Creator
 on another Java container, such as Apache Tomcat, copy the 
cdata.jdbc.apachehbase.jar
 JAR file (the JDBC driver) that is located in the 
databaseDrivers
 directory into the directory that is based on the Java container on which you have installed 
Layer7 Live API Creator
:
Apache Tomcat
Copy the JDBC driver into the
%{CATALINA_HOME}/lib
 directory.
Oracle WebLogic
Copy the JDBC driver to the 
<Your WebLogic Domain Directory>/lib
 directory.
JBoss/WildFly
For more information, see Install on JBoss.
IBM WebSphere
Add the JDBC driver to your Web application server.
Using the WebSphere administrative console, create a JDBC provider for the driver in the server.
For more information about how to create a JDBC provider, see the IBM WebSphere documentation.
For more information:
Connect to an HBase Database
You can connect to your HBase database using the following methods:
  • (If you have not created your API yet) When you create your API.
    For more information about how to create an API, see Creating APIs.
  • (If you have an existing API) By adding a connection to an HBase data source.
    For more information about how to add a connection to a data source, see Database Connectivity
The following procedure details how to connect to your HBase database when creating your API.
Prerequisite:
You know your HBase REST connection information. For more information about how to start the REST server, see the Apache HBase documentation.
Follow these steps:
  1. In API Creator, on the APIs page, click 
    Create New API
    .
    The connection wizard opens.
  2. Click 
    Database First
    .
  3. Select 
    Apache HBase
     as the data source type.
  4. Complete the following fields, and then click 
    Continue
    :
    REST Server
    The server name or IP address.
    Example:
     127.0.0.1
    REST Port
    The port number running the HBase REST service. The JDBC driver attaches to and reads tables and columns by connecting to HBase using the REST port (for example, 2199).
    Example:
     2199
You are connected to the HBase database.
Make all Columns VARCHAR and Turn Off Types
The HBase JDBC driver does not know about your schema. The driver tries to approximate the actual datatypes by scanning the data. The driver samples the first N rows to determine the column names and types. You can make all columns VARCHAR and can turn off types by adding the following line to the JDBC URL:
typeDetectionScheme=none
HBase Supported Data Types
You can read and write the following HBase data types:
When you are setting up a connection to an external data source, 
Layer7 Live API Creator
 must map the data types in the data source to data types in 
Layer7 Live API Creator
. The following table lists the different data type mappings applicable when working with an HBase database.
Layer7 Live API Creator
 supports read and write of the following data types:
Data type
Modeled as...
Notes
base64
binary
Boolean
Boolean
byte 
Bitmask
date
SimpleDate
For more information about how to use this data type in JavaScript, see Date, Time, Timestamp, and TimestampOffset.
datetime
SimpleTimestampOffset
For more information about how to use this data type in JavaScript, see Date, Time, Timestamp, and TimestampOffset.
double
decimal
int
decimal
string
string
time
SimpleTime
For more information about how to use this data type in JavaScript, see Date, Time, Timestamp, and TimestampOffset.
HBase Data Source Limitations
The following limitations are known in HBase data sources.
Display of Column Names in Data Explorer
If a column name contains a colon (:) character, you cannot view HBase data in the Main Grid and the Child Grid in Data Explorer.
For more information about Data Explorer, see Data Explorer.
Implement Transaction Logic
You can implement transaction logic in 
Layer7 Live API Creator
 only by creating early event rules or pre-insert event rules.
For more information about event rules, see Event Rule Types.