0

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?

Thilo
  • 257,207
  • 101
  • 511
  • 656
  • 1
    Related question (limited to "pure Java"): http://stackoverflow.com/questions/2873581/is-it-possible-to-access-a-bdb-from-pure-java – Thilo Jun 11 '11 at 01:11

2 Answers2

1

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.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
0

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:

  • If you are using the (standard) key/value interface:

../dist/configure --enable-java --prefix=/usr/local/db

make install

  • If you are using the SQL API:

../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.

Chris Frederick
  • 5,482
  • 3
  • 36
  • 44
Eric Jensen
  • 453
  • 4
  • 14