private void runInitScriptIfRequired(String url,Connection connection) throws SQLException {
  Matcher matcher=INITSCRIPT_MATCHING_PATTERN.matcher(url);
  if (matcher.matches()) {
    String initScriptPath=matcher.group(2);
    try {
      URL resource=Resources.getResource(initScriptPath);
      String sql=Resources.toString(resource,Charsets.UTF_8);
      ScriptUtils.executeSqlScript(connection,initScriptPath,sql);
    }
 catch (    IOException|IllegalArgumentException e) {
      LOGGER.warn("Could not load classpath init script: {}",initScriptPath);
      throw new SQLException("Could not load classpath init script: " + initScriptPath,e);
    }
catch (    ScriptException e) {
      LOGGER.error("Error while executing init script: {}",initScriptPath,e);
      throw new SQLException("Error while executing init script: " + initScriptPath,e);
    }
  }
}

private void runInitScriptIfRequired ( String url , Connection connection ) throws SQLException { Matcher matcher = INITSCRIPT_MATCHING_PATTERN . matcher ( url ) ; if ( matcher . matches ( ) ) { String initScriptPath = matcher . group ( 2 ) ; try { URL resource = Resources . getResource ( initScriptPath ) ; String sql = Resources . toString ( resource , Charsets . UTF_8 ) ; ScriptUtils . executeSqlScript ( connection , initScriptPath , sql ) ; } catch ( IOException | IllegalArgumentException e ) { LOGGER . warn ( "Could not load classpath init script: {}" , initScriptPath ) ; throw new SQLException ( "Could not load classpath init script: " + initScriptPath , e ) ; } catch ( ScriptException e ) { LOGGER . error ( "Error while executing init script: {}" , initScriptPath , e ) ; throw new SQLException ( "Error while executing init script: " + initScriptPath , e ) ; } } }
run an init script from the classpath .
