DEV Community

Cover image for Introduction to the Aerospike JDBC driver
Alexander Radzin
Alexander Radzin

Posted on • Updated on

Introduction to the Aerospike JDBC driver


Once upon a time when all databases were relational and supported SQL, Java programmers (almost) did not care about the database type they were going to use. This was achieved by using JDBC drivers - software that talks to the specific database exposing standard API to the application layer.

The world has changed after the invention of NoSQL databases. These databases have some advantages comparing to the traditional relational databases but they do not have common interface. Therefore, using them requires writing specific application code for each database.

Aerospike is a popular, fast, mature NoSQL database. It provides client libraries for different systems and languages including Java. These libraries help to implement applications that use Aerospike DB. However, application code which uses this library has to be specific for Aerospike.

The Aerospike JDBC Driver enables users to connect with Aerospike DB directly from any application that supports standard JDBC connectivity.

Key features

This is a JDBC driver. It can be used by any JDBC complaint application, e.g. UI, monitoring, querying and other general purpose tools. It supports standard SQL statements and functions and can be used by developers, QA, data analysts and DevOps engineers. It can help if somebody wants to migrate his application from relational DB to Aerospike.

This article will briefly enumerate the key features of the driver. The next articles of this series will explain particular features in depth.

SQL compliance





WHERE - using PK or any other column and the combination of them including calculations, parentheses etc.

Data types

The driver supports all basic Aerospike types (integer, string, bytes,
double) mapping them to JDBC types (INTEGER, VARCHAR, BLOB, DOUBLE) respectively and corresponding java types (int, String, byte[], double). Aerospike lists and maps are supported as well. They are mapped to the JDBC java.sql.Array and java.util.Map respectively.

Additionally driver can store and retrieve java objects using either standard java serialization mechanism (for Serializable or Externalizable classes) or using custom serialization/deserialization) enabled by user defined functions.

Expressions and functions

Mathematical expressions can be used in the queries:

select first_name, last_name, year()-year_of_birth as age from people

Built-in Functions

  • aggregation functions: count(), max(), min(), sum(), avg()
  • string functions: str(), concat(), ucase(), lcase(), len(), reverse() etc.
  • date/time functions: now(), year(), month(), day() etc.

User-defined functions

The driver provides a lot of built-in functions. Moreover, it can be easily extended. User can implement his own functions in Java and register them via JDBC connection parameters.

Project home

The project is available in GitHub.

What's next

Next article of this series will explain the SQL compliance of the driver.

Top comments (0)