Protect handle db with a mutex