verfies database connected state before query