I need to read BerkeleyDB files from Java.
Oracle has an official Java Edition of BerkeleyDB, but it seems that this uses its own, incompatible binary file format.
What do I do?
I need to read BerkeleyDB files from Java.
Oracle has an official Java Edition of BerkeleyDB, but it seems that this uses its own, incompatible binary file format.
What do I do?
According to the Wikipedia page, there are Java bindings for classic Berkeley DB, but they require use of JNI and a native library. Here's a link to the Sleepycat Berkeley DB - Java API documentation.
Berkeley DB can actually store data in 2 different formats, depending on whether you elect to use the SQL API or not. The SQL API is a recent addition, Berkeley DB has historically been a key/value database.
It is true that you need to build the native library and use JNI, but this is to be expected if you want to access files created by a native library. Fortunately, the build process is very simple.
If you are building under Windows, please refer to the installation guide.
For Linux or other *NIX, after you have untarred the file go to the build_unix directory and do one of the following:
../dist/configure --enable-java --prefix=/usr/local/db
make install
../dist/configure --enable-sql --enable-jdbc --prefix=/usr/local/db
make install
(Obviously you can replace --prefix with the install location of your choice)
For more information see the docs page.
Hope that helps, good luck with your project.