--- a/java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java Mon Dec 23 16:19:21 2013 +0100
+++ b/java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java Mon Dec 23 16:29:51 2013 +0100
@@ -109,9 +109,10 @@
if (fd == null) {
throw new ConfigurationException("Formatter is not configured: " + options.getFormatterName());
} else {
- DatabaseConnection c = dd.connect();
- Formatter f = fd.getInstance(new FormatterContext(options.getOutputStream()));
- c.executeQuery(options.getSQLCommand(), f);
+ try (DatabaseConnection c = dd.connect()) {
+ Formatter f = fd.getInstance(new FormatterContext(options.getOutputStream()));
+ c.executeQuery(options.getSQLCommand(), f);
+ }
}
}
}