public static void withInstance(Map<String,Object> args,Closure c) throws SQLException, ClassNotFoundException {
  Sql sql=null;
  try {
    sql=newInstance(args);
    c.call(sql);
  }
  finally {
    if (sql != null)     sql.close();
  }
}

public static void withInstance ( Map < String , Object > args , Closure c ) throws SQLException , ClassNotFoundException { Sql sql = null ; try { sql = newInstance ( args ) ; c . call ( sql ) ; } finally { if ( sql != null ) sql . close ( ) ; } }
invokes a closure passing it a new sql instance created from the given map of arguments . the created connection will be closed if required .
