#4965 Implement general solution for getDatabase() in