in reply to Locking a DB

That depends on exactly what DB you're using. If it's a file based DB (such as the *DBM_File modules), there are methods you can use to lock the entire database - they're all documented in the man page.

If you're using a RDBMS (such as MySQL, Oracle, or PostgreSQL) then you can get away with more fine grained locking, depending on the database. MySQL, for example, only supports table locking, while PostgreSQL supports individual row locking. Check out the docs on whichever server you're using if this is the case.