Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
.settings/ | 12-May-2024 | - | 10 | 10 | ||
example/ | 12-May-2024 | - | 129 | 102 | ||
src/ | 12-May-2024 | - | 5,636 | 3,847 | ||
.editorconfig | D | 12-May-2024 | 93 | 7 | 6 | |
.gitignore | D | 12-May-2024 | 41 | 5 | 4 | |
CMakeLists.txt | D | 12-May-2024 | 228 | 5 | 4 | |
README.md | D | 12-May-2024 | 1.8 KiB | 57 | 41 | |
hints.txt | D | 12-May-2024 | 102 | 6 | 2 | |
pom.xml | D | 12-May-2024 | 1.1 KiB | 32 | 28 | |
version.txt | D | 12-May-2024 | 2 |
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