1 Reply Latest reply: Mar 17, 2012 9:14 AM by Greybird-Oracle RSS

    Can multiple threads share the same cursor in berkeley db java edition?

    918395
      We use berkeley db to store our path computation results. We now have two threads which need to retrieve records from database. Specifically, the first thread accesses the database from the very beginning and read a certain number of records. Then, the second thread needs to access the database and read the rest records starting from the position where the cursor stops in the first thread. But, now, I cannot let these two threads share the same cursor. So, I have to open the database separately in two threads and use individual cursor for each thread. This means I have to in the second thread let the cursor skip the first certain number of records and then read the rest records. However, in this way, it is a waste of time letting the second thread skip a certain of records. It will be ideal for us that the second thread can start reading the record just from the place where the first thread stops. Actually, I have tried using transactional cursor and wanted to let the two threads share the same transactional cursor. But it seems that this didn't work.

      Can anyone give any suggestion? Thank you so much!

      sgao
        • 1. Re: Can multiple threads share the same cursor in berkeley db java edition?
          Greybird-Oracle
          If your question is really about using the BDB Java Edition product please post to the JE forum:
          Berkeley DB Java Edition

          If your question is about using the Java API of the BDB (C-based) product, then this is the correct forum.

          --mark