Update database detection function