public void loadConfiguration(String file) {

        if(configFile == null)

        try {
            Properties props = Util.readProperties(file);
            Set<String> environments = props.stringPropertyNames().stream().map(n -> n.substring(0, n.lastIndexOf("."))).collect(toSet());
            for (String env : environments) {
                String jndiName = env + "." + "jndi";
                if (props.containsKey(jndiName)) {
                    createJndiWrapper(env, props.getProperty(jndiName));
                } else {
                    String driver = props.getProperty(env + ".driver");
                    String userName = props.getProperty(env + ".username");
                    String password = props.getProperty(env + ".password");
                    String url = props.getProperty(env + ".url");
                    checkProps(driver, userName, password, url, env);
                    createJdbcWrapper(env, driver, url, userName, password);
                }
            }
        } catch (InitException e) {
            throw e;
        } catch (Exception e) {
            throw new InitException(e);
        }
    }
public void loadConfiguration ( String file ) { if ( configFile == null ) try { Properties props = Util . readProperties ( file ) ; Set < String > environments = props . stringPropertyNames ( ) . stream ( ) . map ( n -> n . substring ( 0 , n . lastIndexOf ( "." ) ) ) . collect ( toSet ( ) ) ; for ( String env : environments ) { String jndiName = env + "." + "jndi" ; if ( props . containsKey ( jndiName ) ) { createJndiWrapper ( env , props . getProperty ( jndiName ) ) ; } else { String driver = props . getProperty ( env + ".driver" ) ; String userName = props . getProperty ( env + ".username" ) ; String password = props . getProperty ( env + ".password" ) ; String url = props . getProperty ( env + ".url" ) ; checkProps ( driver , userName , password , url , env ) ; createJdbcWrapper ( env , driver , url , userName , password ) ; } } } catch ( InitException e ) { throw e ; } catch ( Exception e ) { throw new InitException ( e ) ; } }
Configures multiple database connections from a single property file. Example content for such file:

<pre>
development.driver=com.mysql.jdbc.Driver
development.username=john
development.password=pwd
development.url=jdbc:mysql://localhost/proj_dev

test.driver=com.mysql.jdbc.Driver
test.username=mary
test.password=pwd1
test.url=jdbc:mysql://localhost/test

production.jndi=java:comp/env/jdbc/prod

# this one is to run migrations in production remotely
production.remote.driver=com.mysql.jdbc.Driver
production.remote.username=root
production.remote.password=xxx
production.remote.url=jdbc:mysql://127.0.0.1:3307/poj1_production

</pre>

Rules and limitations of using a file-based configuration:

<ul>
<li>Only one database connection can be configured per environment (with the exception of development and test connections
only in development environment)</li>
<li>Currently additional database parameters need to be specified as a part of a database URL</li>
<li>Database connection named "test" in the database configuration file is for "development" environment and is
automatically marked for testing (will be used during tests)</li>
<li>All connections specified in a property file automatically assigned DB name "default"
</ul>

@param file path to a file. Can be located on classpath, or on a file system. First searched on classpath,
then on file system.