This discussion is archived
1 Reply Latest reply: Jun 29, 2012 1:39 AM by Andrei Costache, Oracle RSS

Interoperability between Java and C API

613525 Newbie
Currently Being Moderated
Dear experts,

Can I use Java API for reading data which was written with C API and vice versa?
I don't mean BDB JE. I mean Java API of core edition which uses JNI.
And is it safe way to use?

Thank you in advance.
  • 1. Re: Interoperability between Java and C API
    Andrei Costache, Oracle Journeyer
    Currently Being Moderated
    Hi,

    Yes you can do it and yes it should be safe if you correctly architect your application. The data is stored in the same format and using whatever organization is required by the access method that you have selected (Btree, Hash, Queue, Recno, Heap), and you can manipulate it from any of the Berkeley DB's APIs you want (C, C++, Java/JNI, C#). And, you can have multiple processes accessing the same BDB environment, each written underneath using a different BDB API. Of course, it's up to the application to correctly ensure byte alignment for returned key/data pairs.

    Actually this is a question which has come up before in the forum; check just a few of the threads discussing it: Re: C + + data can be stored in bdb do with java read?, can Java read C etc.

    Regards,
    Andrei

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points