Try-catch-finally and then again a try catch
Write a SQLUtils class that contains static closeQuietly methods that catch and log such exceptions, then use as appropriate. You’ll end up with something that reads like this: public class SQLUtils { private static Log log = LogFactory.getLog(SQLUtils.class); public static void closeQuietly(Connection connection) { try { if (connection != null) { connection.close(); } } catch … Read more