Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
52 lines (37 sloc) 1.43 KB

EJDB2 Java JNI binding

Embeddable JSON Database engine http://ejdb.org Java binding.

See https://github.com/Softmotions/ejdb/blob/master/README.md

For API usage examples take a look into EJDB2Example.java and TestEJDB2.java classes.

Minimal example

public static void main(String[] args) {
  try (EJDB2 db = new EJDB2Builder("example.db").truncate().open()) {
    long id = db.put("parrots", "{\"name\":\"Bianca\", \"age\": 4}");
    System.out.println("Bianca record: " + id);

    id = db.put("parrots", "{\"name\":\"Darko\", \"age\": 8}");
    System.out.println("Darko record: " + id);

    db.createQuery("@parrots/[age > :age]").setLong("age", 3).execute((docId, doc) -> {
      System.out.println(String.format("Found %d %s", docId, doc));
      return 1;
    });
  }
}

Supported platforms

  • Linux x64
  • OSX

How to build it manually

git clone https://github.com/Softmotions/ejdb.git
cd ./ejdb
mkdir ./build && cd build
cmake .. -DBUILD_JNI_BINDING=ON -DCMAKE_BUILD_TYPE=Release
make

Run example

cd build/src/bindings/ejdb2_jni/src

java -Djava.library.path=. \
     -cp ejdb2jni.jar \
     com.softmotions.ejdb2.example.EJDB2Example
You can’t perform that action at this time.