4

I have a berkeley db file (*.bdb) which is created by the C implementation(python bsddb module). Is it possible to read this file by a pure java implementation of Berkeley Db? I tried to read it using berkeley db java edition (je) but could not. je throws out an exception saying that it could not detect the berkeley database. Are berkeley db files not inter operable across different implementations? If so, why?

Francisco Alvarado
  • 2,767
  • 1
  • 23
  • 51
NeoAnderson
  • 377
  • 2
  • 4
  • 11

3 Answers3

5

No.

According to the Berkeley DB Java Edition FAQ, Berkeley DB and Berkeley DB Java Edition are not compatible with one another because they have a different file layout structure.

AndrewR
  • 10,339
  • 10
  • 42
  • 56
Christopher Dolan
  • 159
  • 1
  • 4
  • 17
2

Note that there are three different products

  1. Berkeley DB -- the C implementation
  2. Berkeley DB Java Edition
  3. Berkeley DB XML

see, Wikipedia

It is true that the "Berkeley DB" and "Berkeley DB Java Edition" have different (i.e. incompatible) file format. However, the "Berkeley DB" product does provide a Java API via JNI. So it is possible to access data file written by the C implementation from Java, but not with the "Berkeley DB Java Edition".

ubiyubix
  • 1,001
  • 9
  • 13
0

I haven't researched the definite answer, but I have the same experience. A database created with pythons bdb, and also accessible with the cli utils, is not detected at all by the Java API. The reverse was also true.

Staale
  • 24,584
  • 22
  • 63
  • 85