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?
我有一个berkeley db文件(* .bdb),由C实现(python bsddb模块)创建。是否可以通过Berkeley Db的纯Java实现读取此文件?我尝试使用berkeley db java edition(je)阅读它,但不能。 je抛出了一个例外,说它无法检测到berkeley数据库。 berkeley db文件是否在不同实现之间可互操作?如果是这样,为什么?
3 个解决方案
#1
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.
根据Berkeley DB Java Edition FAQ,Berkeley DB和Berkeley DB Java Edition彼此不兼容,因为它们具有不同的文件布局结构。
#2
2
Note that there are three different products
请注意,有三种不同的产品
- Berkeley DB -- the C implementation
- Berkeley DB Java Edition
- Berkeley DB XML
Berkeley DB - C实现
Berkeley DB Java版
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".
确实,“Berkeley DB”和“Berkeley DB Java Edition”具有不同(即不兼容)的文件格式。但是,“Berkeley DB”产品确实通过JNI提供了Java API。因此,可以从Java访问由C实现编写的数据文件,但不能访问“Berkeley DB Java Edition”。
#3
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.
我没有研究确切的答案,但我有相同的经验。使用pythons bdb创建的数据库,也可以使用cli utils访问,Java API根本检测不到。反过来也是如此。
#1
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.
根据Berkeley DB Java Edition FAQ,Berkeley DB和Berkeley DB Java Edition彼此不兼容,因为它们具有不同的文件布局结构。
#2
2
Note that there are three different products
请注意,有三种不同的产品
- Berkeley DB -- the C implementation
- Berkeley DB Java Edition
- Berkeley DB XML
Berkeley DB - C实现
Berkeley DB Java版
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".
确实,“Berkeley DB”和“Berkeley DB Java Edition”具有不同(即不兼容)的文件格式。但是,“Berkeley DB”产品确实通过JNI提供了Java API。因此,可以从Java访问由C实现编写的数据文件,但不能访问“Berkeley DB Java Edition”。
#3
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.
我没有研究确切的答案,但我有相同的经验。使用pythons bdb创建的数据库,也可以使用cli utils访问,Java API根本检测不到。反过来也是如此。