check db is alive before queries