moved openDb to executeQuery method