示例#1
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();
    }
  }
示例#2
0
  public static void main(String[] arg) {
    try {

      // UIManager.setLookAndFeel( lef );

      ArgList list = ArgUtils.parseArgsProps(arg);

      String url = list.findArg("c").getValue();
      String usr = list.findArg("u").getValue();

      Color bc = parseColor(list.findArg("bc"), null);
      Color fc = parseColor(list.findArg("fc"), null);

      ConnectionFactory cp = ConnArgs.createConnectionFactory(list);

      CMDFrame frame =
          CMDFrame.getInstance(
              "XJSQL " + url + " (" + usr + ")",
              new ConnCMD(SQLCMDUtils.newSQLCMDComplete(cp)),
              new CloseOnExit(),
              bc,
              fc);

      frame.setHelpText(HELP_TEXT);
      frame.setInfoText(INFO_TEXT);

    } catch (Throwable e) {
      System.err.println(" options : ");
      System.err.println("      -d  [jdbc-driver-class] ");
      System.err.println("      -c  [jdbc-url] ");
      System.err.println("      -u  [username] ");
      System.err.println("      -p  [password] ");
      System.err.println(
          "      -bc  [rrrgggbbb] (optional, range is 000-255, default '255255255')");
      System.err.println(
          "      -fc  [rrrgggbbb] (optional, range is 000-255, default '000000000')");
      System.err.println();
      e.printStackTrace();
    }
  }
示例#3
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();
   }
 }