java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java
branchv_0
changeset 75 43aa4625ab7e
parent 70 02c8eaa425e8
child 80 c4635ab3a7af
     1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java	Thu Dec 26 22:39:38 2013 +0100
     1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java	Fri Dec 27 00:57:34 2013 +0100
     1.3 @@ -122,19 +122,11 @@
     1.4  
     1.5  	private void processQueryNow() throws ConfigurationException, SQLException, FormatterException {
     1.6  		DatabaseDefinition dd = getConfiguration().getDatabase(options.getDatabaseName());
     1.7 -		if (dd == null) {
     1.8 -			throw new ConfigurationException("Database is not configured: " + options.getDatabaseName());
     1.9 -		} else {
    1.10 -			FormatterDefinition fd = configuration.getFormatter(options.getFormatterName());
    1.11 -			if (fd == null) {
    1.12 -				throw new ConfigurationException("Formatter is not configured: " + options.getFormatterName());
    1.13 -			} else {
    1.14 -				try (DatabaseConnection c = dd.connect()) {
    1.15 -					log.log(Level.FINE, "Database connected");
    1.16 -					Formatter f = fd.getInstance(new FormatterContext(options.getOutputStream()));
    1.17 -					c.executeQuery(options.getSQLCommand(), f);
    1.18 -				}
    1.19 -			}
    1.20 +		FormatterDefinition fd = configuration.getFormatter(options.getFormatterName());
    1.21 +		try (DatabaseConnection c = dd.connect()) {
    1.22 +			log.log(Level.FINE, "Database connected");
    1.23 +			Formatter f = fd.getInstance(new FormatterContext(options.getOutputStream()));
    1.24 +			c.executeQuery(options.getSQLCommand(), f);
    1.25  		}
    1.26  	}
    1.27