Using jdbm 0.12 B-tree with jdbm 1.0 code

Help
2005-10-18
2013-06-03
  • I have a database with B-tree created with the jdbm 0.12 code. When I tried to upgrade my code to use jdbm 1.0 I got java.io.OptionalDataException.
    Can I use my existing database with the new jdbm 1.0 code?

     
    • Alex Boisvert
      Alex Boisvert
      2005-10-19

      Hi Roubik,

      Could you provide the full stacktrace for your exception?

      alex

       
      • java.io.OptionalDataException
            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1310)
            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
            at jdbm.btree.BTree.readExternal(BTree.java:538)
            at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1753)
            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1711)
            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
            at jdbm.helper.Serialization.deserialize(Serialization.java:93)
            at jdbm.helper.DefaultSerializer.deserialize(DefaultSerializer.java:97)
            at jdbm.recman.BaseRecordManager.fetch(BaseRecordManager.java:341)
            at jdbm.recman.CacheRecordManager.fetch(CacheRecordManager.java:263)
            at jdbm.recman.CacheRecordManager.fetch(CacheRecordManager.java:242)
            at jdbm.btree.BTree.load(BTree.java:276)

         
        • Alex Boisvert
          Alex Boisvert
          2005-10-19

          Roubik,

          I've done a "diff" between 0.12 and 1.0 and there have been some changes in the serialization of the BTree datastucture that are non-backward compatible.  In particular, the BTree now persists key/value serializers, if any.

          alex