move getDsn out of try catch block