util-liquibase-installer/src/main/java/com/hpe/caf/utilliquibaseinstaller/Application.java
private void updateDB() throws SQLException, LiquibaseException
    {
        System.out.println("About to perform DB update.");
        try (BasicDataSource dataSource = new BasicDataSource()) {
            dataSource.setUrl(fullConnectionString);
            dataSource.setUsername(username);
            dataSource.setPassword(password);
            try (java.sql.Connection c = dataSource.getConnection()) {
                Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(c));

                // Check that the Database does indeed exist before we try to run the liquibase update.
                Liquibase liquibase = null;
                ClassLoaderResourceAccessor accessor = new ClassLoaderResourceAccessor();
                try {
                    if (accessor.getResourcesAsStream("changelog-master.xml") != null) {
                        liquibase = new Liquibase("changelog-master.xml", new ClassLoaderResourceAccessor(), database);
                    } else if (accessor.getResourcesAsStream("changelog.xml") != null) {
                        liquibase = new Liquibase("changelog.xml", new ClassLoaderResourceAccessor(), database);
                    } else {
                        String errorMessage = "No liquibase changelog-master.xml or changelog.xml could be located";
                        Logger.getLogger(Application.class.getName()).log(Level.SEVERE, errorMessage, this);
                        throw new RuntimeException(errorMessage);
                    }
                } catch (final IOException ioe) {
                    Logger.getLogger(Application.class.getName()).log(Level.SEVERE, ioe.getMessage(), ioe);
                }

                liquibase.getLog().setLogLevel(logLevel);
                liquibase.update(new Contexts());
                System.out.println("DB update finished.");
            }
        }
    }
private void updateDB() throws SQLException, LiquibaseException
    {
        System.out.println("About to perform DB update.");
        try (BasicDataSource dataSource = new BasicDataSource()) {
            dataSource.setUrl(fullConnectionString);
            dataSource.setUsername(username);
            dataSource.setPassword(password);
            try (java.sql.Connection c = dataSource.getConnection()) {
                Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(c));

                // Check that the Database does indeed exist before we try to run the liquibase update.
                Liquibase liquibase = null;
                ClassLoaderResourceAccessor accessor = new ClassLoaderResourceAccessor();
                try {
                    if (accessor.getResourcesAsStream("changelog-master.xml") != null) {
                        liquibase = new Liquibase("changelog-master.xml", new ClassLoaderResourceAccessor(), database);
                    } else if (accessor.getResourcesAsStream("changelog.xml") != null) {
                        liquibase = new Liquibase("changelog.xml", new ClassLoaderResourceAccessor(), database);
                    } else {
                        String errorMessage = "No liquibase changelog-master.xml or changelog.xml could be located";
                        Logger.getLogger(Application.class.getName()).log(Level.SEVERE, errorMessage, this);
                        throw new RuntimeException(errorMessage);
                    }
                } catch (final IOException ioe) {
                    Logger.getLogger(Application.class.getName()).log(Level.SEVERE, ioe.getMessage(), ioe);
                }

                liquibase.getLog().setLogLevel(logLevel);
                liquibase.update(new Contexts());
                System.out.println("DB update finished.");
            }
        }
    }
private void updateDB ( ) throws SQLException , LiquibaseException { System . out . println ( "About to perform DB update." ) ; try ( BasicDataSource dataSource = new BasicDataSource ( ) ) { dataSource . setUrl ( fullConnectionString ) ; dataSource . setUsername ( username ) ; dataSource . setPassword ( password ) ; try ( java . sql . Connection c = dataSource . getConnection ( ) ) { Database database = DatabaseFactory . getInstance ( ) . findCorrectDatabaseImplementation ( new JdbcConnection ( c ) ) ; // Check that the Database does indeed exist before we try to run the liquibase update. Liquibase liquibase = null ; ClassLoaderResourceAccessor accessor = new ClassLoaderResourceAccessor ( ) ; try { if ( accessor . getResourcesAsStream ( "changelog-master.xml" ) != null ) { liquibase = new Liquibase ( "changelog-master.xml" , new ClassLoaderResourceAccessor ( ) , database ) ; } else if ( accessor . getResourcesAsStream ( "changelog.xml" ) != null ) { liquibase = new Liquibase ( "changelog.xml" , new ClassLoaderResourceAccessor ( ) , database ) ; } else { String errorMessage = "No liquibase changelog-master.xml or changelog.xml could be located" ; Logger . getLogger ( Application . class . getName ( ) ) . log ( Level . SEVERE , errorMessage , this ) ; throw new RuntimeException ( errorMessage ) ; } } catch ( final IOException ioe ) { Logger . getLogger ( Application . class . getName ( ) ) . log ( Level . SEVERE , ioe . getMessage ( ) , ioe ) ; } liquibase . getLog ( ) . setLogLevel ( logLevel ) ; liquibase . update ( new Contexts ( ) ) ; System . out . println ( "DB update finished." ) ; } } }
Checks connection, retrieves appropriate changelog and performs database update.

@throws SQLException
@throws LiquibaseException
Checks connection retrieves appropriate changelog and performs database update .