Serialize database access.