Forum Stats

  • 3,840,118 Users
  • 2,262,569 Discussions
  • 7,901,154 Comments

Discussions

[Problem] About : Dbc Retrieve Data in MultiThread

528426
528426 Member Posts: 1
edited Aug 16, 2006 8:43AM in Berkeley DB
Hello,

Our BDB version is 4.0.14 and 4.2.52.

We create our JNI by using BDB C++ API. Under multi-processor,
multithread environment, we do the following operations in the
same Java process:

Db->open()
Dbc->get()
Dbc->put()
Db->close()

After running for 2 hours, when we try to retrieve the data
by using Dbc->get(), it returns error code [DB_NOTFOUND].
In the meantime, another process calls Db->open() and Dbc->get()
and works correctly, without returning any error code.

Would you please tell us how to solve this problem.
Thank you very much.

Comments

  • 512799
    512799 Member Posts: 494
    HI,
    Db->open()
    Dbc->get()
    Dbc->put()
    Db->close()
    After running for 2 hours, when we try to retrieve the data
    by using Dbc->get(), it returns error code [DB_NOTFOUND].
    In the meantime, another process calls Db->open() and Dbc->get()
    and works correctly, without returning any error code
    You didn't explicitly mention using a Berkeley DB environment which is required for multi-threaded and/or multi-process access.

    When you use an environment, resources such as the in-memory cache and locks can be shared by all of the databases opened in the environment. The environment allows you to enable subsystems that are designed to allow multiple threads and/or processes to access DB databases. For example, you use an environment to enable the concurrent data store (CDS), the locking subsystem, and/or the shared memory buffer pool.

    http://www.sleepycat.com/docs/gsg/JAVA/environments.html


    Ron
This discussion has been closed.