switch jdbc to use try-with-resources