Skip to content

PharosProduction/aerospike-jdbc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Aerospike JDBC Driver

Build Maven Central javadoc

Aerospike JDBC Driver allows you to interact with Aerospike clusters by using SQL statements from your Java application.
Read Java Tutorials to get started with JDBC.

Prerequisites

  • Java 8 or later
  • Aerospike Server version 5.2+

Build

mvn clean package

The JDBC driver jar uber-aerospike-jdbc-<version>.jar will be created under the target folder.

Pre-built versions of the driver are available in the Releases.

JDBC connection properties

JDBC Driver com.aerospike.jdbc.AerospikeDriver
JDBC URL jdbc:aerospike:HOST[:PORT][/NAMESPACE][?PARAM1=VALUE1[&PARAM2=VALUE2]1

1 For example jdbc:aerospike:localhost connects to the Aerospike database running on a local machine and listening on the default port (3000). The jdbc:aerospike:172.17.0.5:3300/test URL connects to the test namespace on the Aerospike database running on 172.17.0.5:3300.

Usage example

try {
    String url = "jdbc:aerospike:localhost:3300/test";
    Connection connection = DriverManager.getConnection(url);

    String query = "select * from ns1 limit 10";
    ResultSet resultSet = connection.createStatement().executeQuery(query);
    while (resultSet.next()) {
        String bin1 = resultSet.getString("bin1");
        System.out.println(bin1);
    }
} catch (Exception e) {
    System.err.println(e.getMessage());
}

Packages documentation can be found here.

Supported SQL Statements

  • SELECT
  • INSERT
  • UPDATE
  • DELETE
  • TRUNCATE TABLE

See examples of SQL.

1 JOIN, nested SELECT queries and GROUP BY statements are not in the scope of the current version.

2 The development is in progress, and minor features documentation is not maintained now.

JDBC Client tools

  • DBeaver
    Configure the Aerospike JDBC Driver:

    • Database -> Driver Manager -> New
      Fill in settings:
      • Driver Name: Aerospike
      • Driver Type: Generic
      • Class Name: com.aerospike.jdbc.AerospikeDriver
      • URL Template: jdbc:aerospike:{host}[:{port}]/[{database}]1
      • Default Port: 3000
    • Click the Add File button and add the JDBC jar file.
    • Click the Find Class button.
    • Click OK.

    Create a connection:

    • Database -> New Database Connection
    • Select Aerospike and click Next.
    • Fill in the connection settings
      • Host and Port
      • Database/Schema: the namespace you are connecting to
      • Username and Password if you have security turned on in Aerospike Database Enterprise Edition
    • Click Finish.

    1 Specify the database parameter for proper functionality.

DBeaverAerospike

  • JetBrains DataGrip

    Configure the Aerospike JDBC Driver:

    • Database > + > Driver
      • Name: Aerospike
      • Comment (Optional): Aerospike Driver
      • Driver Files > + > Custom JARs… > add the Aerospike JDBC jar file
      • URL Template > + > jdbc:aerospike:{host}[:{port}]/[{database}]
      • Class: select “com.aerospike.jdbc.AerospikeDriver” (should appear after doing the previous steps).
      • Apply.

    Configure the data source connection:

    • Go to the Data Sources tab > + > Aerospike
      • Choose No Auth or Username & Password if you have security turned on in Aerospike Database Enterprise Edition.
      • URL: fill the Host, Port and the namespace (For example: jdbc:aerospike:localhost:3000/test).
      • Apply (ignore the warning).

JetBrainsDataGripAerospike

License

Licensed under the Apache 2.0 License.

About

Minimalist JDBC driver for Aerospike.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%