db connect try except