lock or unlock the database