Git Product home page Git Product logo

aerospike-jdbc's Introduction

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. When the namespace is provided in the JDBC URL a table name is assumed to be in that connection's namespace, and there is no need to mention the namespace in the query. In this example the following will get the records in namespace test and set demo.

SELECT * FROM demo;

See more about optional configuration parameters.

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
      • Host: host URL (such as localhost or 0.0.0.0)
      • Port: port by default should be 3000
      • Database/Schema: database by default should be test
    • 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.

aerospike-jdbc's People

Contributors

arrowplum avatar rbotzer avatar reugn avatar roimenashe avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.