check if db is defined