bsddb3 locking questions



are there any simple examples of how to do record locking with bsddb3?

the bsddb3 documentation is reasonably opaque. For example, the DB initialization requires a DBEnv instance for certain environmental features such as locking. but if you want locking, what happens next? I suspect the pattern goes something like the following but it's not clear from the documentation.

dbe = DBEnv.open()
(does the home directory need to be specified or is there a systemwide default? Is this per application or does a common pool work?


dbe.set_lk_detect(...DB_LOCK_YOUNGEST)
(but what about db_deadlock??? do I need a cron job?)

dbe.lock_id()

dbi = db.DB()

dbi.open(..)
(does the filename specified here need to be the same directory as the homedir in DBEnv or can it in a totally separate location? any advantages to either?)


lock = dbe.get_lock()
dbi.get/put
dbe.lock_put(lock)

(the above pattern is for record locking but for database locking, the lock get and put calls would bracket the open/close call)


if you close the database, should you automatically close the env or (as I suspect) the database environment can cover one or more database specific incarnations but if you have access different databases, each one should have its own environment.


anything else I'm missing?

thanks for any guidance,
---eric

.



Relevant Pages

  • Re: Multiuser Problem
    ... Pessimistic locking - in todays modern languages this is not really the ... requires that you have a database transaction locking the row of the record ... Allow the user to edit the row but before you write the data back to ...
    (microsoft.public.dotnet.languages.vb)
  • RE: 2nd form with recordset of 1st
    ... processes using this table using optimistic locking? ... If this is a split database, is there a persistent connection to the back ... Every directory traversed requires Windows to ... > record source to be the 1st forms recordset? ...
    (microsoft.public.access.formscoding)
  • Re: DBD::Informix -- Error Installing On Mac OSX
    ... the environment correctly, as long as the module reasonably clearly ... working Informix environment than to test for things that might not be ... use either the sysmaster database or the informix user to install ...
    (comp.databases.informix)
  • Re: Can I password a query or table in an Access db?
    ... The other user may edit other ... If you want all other users to stay out of the database while you are using ... The default record locking option will allow you to set the record ... The optimistic locking is the least restrictive and doesn't lock ...
    (microsoft.public.access.security)
  • Re: Help - Timing Logic
    ... build a trigger on the database .. ... Transaction and Database Locking - look at isolation levels / settings ... If you need to implement a locking mechanism / or / logging mechanism / or / a checking mechanism to avoid duplicate messages caused by multi-threading ... ... message broker gets all the necessary messages or message id's from the database to be sent ... ...
    (microsoft.public.dotnet.languages.vb)