Ejemplo n.º 1
0
 public static void main(String[] args) {
   try {
     ArgList argList = ArgUtils.parseArgs(args);
     Arg help = argList.findArg("help");
     if (help == null) {
       String smtp = argList.findArgValue(ARG_SMTP_HOST);
       String user = argList.findArgValue(ARG_SMTP_USER);
       String pass = argList.findArgValue(ARG_SMTP_PASS);
       String from = argList.findArgValue(ARG_FROM_ADDRESS);
       String to = argList.findArgValue(ARG_TO_LIST);
       String cc = argList.findArgValue(ARG_CC_LIST);
       String bcc = argList.findArgValue(ARG_BCC_LIST);
       String subject = argList.findArgValue(ARG_SUBJECT);
       String body = argList.findArgValue(ARG_BODY);
       String attach = argList.findArgValue(ARG_ATTACH);
       String type = argList.findArgValue(ARG_CONTENT_TYPE);
       EmailFacade.send(smtp, user, pass, from, to, cc, bcc, subject, body, type, attach);
     } else {
       printHelp(System.out);
     }
   } catch (Exception e) {
     printHelp(System.err);
     e.printStackTrace();
   }
 }
Ejemplo n.º 2
0
  public static void main(String[] args) {

    try {

      ArgList argList = ArgUtils.parseArgsDefault(args);

      PrintWriter pw = new PrintWriter(System.out);

      String table = "";

      ConnectionFactory cf = ConnArgs.createConnectionFactory(argList);

      Connection conn = cf.getConnection();

      List tableList = null;

      DatabaseMetaData dbmd = conn.getMetaData();

      String[] types = {"TABLE"};

      String s = argList.findArgValue("s");

      ResultSet rs = dbmd.getTables(null, s, null, types);

      while (rs.next()) {
        String schema = rs.getString("TABLE_SCHEM");
        String name = rs.getString("TABLE_NAME");
        if (schema != null) {
          name = "\"" + schema + "\"." + name;
        }
        pw.println("GRANT INSERT, UPDATE, DELETE, SELECT ON " + name + " TO MTTFRANCI;");
      }

      conn.close();

      pw.close();

    } catch (Exception e) {
      e.printStackTrace();
    }
  }