Added exception handling to jdbc connections