Added check of database type in lookup method