• Home
Name Date Size #Lines LOC

..--

.settings/12-May-2024-1010

example/12-May-2024-129102

src/12-May-2024-5,6363,847

.editorconfigD12-May-202493 76

.gitignoreD12-May-202441 54

CMakeLists.txtD12-May-2024228 54

README.mdD12-May-20241.8 KiB5741

hints.txtD12-May-2024102 62

pom.xmlD12-May-20241.1 KiB3228

version.txtD12-May-20242

README.md

1# EJDB2 Java JNI binding
2
3Embeddable JSON Database engine http://ejdb.org Java binding.
4
5See https://github.com/Softmotions/ejdb/blob/master/README.md
6
7For API usage examples take a look into [EJDB2Example.java](https://github.com/Softmotions/ejdb/blob/master/src/bindings/ejdb2_jni/example/src/main/java/EJDB2Example.java) and [TestEJDB2.java](https://github.com/Softmotions/ejdb/blob/master/src/bindings/ejdb2_jni/src/test/java/com/softmotions/ejdb2/TestEJDB2.java) classes.
8
9## Minimal example
10
11```java
12public static void main(String[] args) {
13  try (EJDB2 db = new EJDB2Builder("example.db").truncate().open()) {
14    long id = db.put("parrots", "{\"name\":\"Bianca\", \"age\": 4}");
15    System.out.println("Bianca record: " + id);
16
17    id = db.put("parrots", "{\"name\":\"Darko\", \"age\": 8}");
18    System.out.println("Darko record: " + id);
19
20    db.createQuery("@parrots/[age > :age]").setLong("age", 3).execute((docId, doc) -> {
21      System.out.println(String.format("Found %d %s", docId, doc));
22      return 1;
23    });
24  }
25}
26```
27
28## Supported platforms
29
30- Linux x64
31- MacOS
32
33## Install from Ubuntu PPA
34
35```sh
36sudo add-apt-repository ppa:adamansky/ejdb2
37sudo apt-get update
38sudo apt-get install ejdb2-java
39```
40
41Note: Yoy may need to specify `LD_LIBRARY_PATH` env for `java` in order to help JVM find where
42the `libejdb2jni.so` library is located. For Linux systems `ejdb2-java` PPA debian package installs
43shared library symlink to `/usr/java/packages/lib` folder listed as default library search
44path for JVM so you can skip specifying `LD_LIBRARY_PATH` in that case.
45
46## How to build it manually
47
48```sh
49git clone https://github.com/Softmotions/ejdb.git
50cd ./ejdb
51mkdir ./build && cd build
52cmake .. -DBUILD_JNI_BINDING=ON -DCMAKE_BUILD_TYPE=Release
53make
54```
55
56[Sample EJDB2 java project](./example)
57