Added logging to see which database is used for table lookup