コード例 #1
0
  public void init() {

    DatabaseManagerSwing m = new DatabaseManagerSwing();

    m.main();

    try {
      m.connect(ConnectionDialogSwing.createConnection(defDriver, defURL, defUser, defPassword));
      m.insertTestData();
      m.refreshTree();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
コード例 #2
0
  public static void main(String arg[]) {

    System.getProperties().put("sun.java2d.noddraw", "true");

    // (ulrivo): read all arguments from the command line
    String lowerArg;
    boolean autoConnect = false;

    for (int i = 0; i < arg.length; i++) {
      lowerArg = arg[i].toLowerCase();

      i++;

      bMustExit = true;

      if (lowerArg.equals("-driver")) {
        defDriver = arg[i];
        autoConnect = true;
      } else if (lowerArg.equals("-url")) {
        defURL = arg[i];
        autoConnect = true;
      } else if (lowerArg.equals("-user")) {
        defUser = arg[i];
        autoConnect = true;
      } else if (lowerArg.equals("-password")) {
        defPassword = arg[i];
        autoConnect = true;
      } else if (lowerArg.equals("-dir")) {
        defDirectory = arg[i];
      } else if (lowerArg.equals("-script")) {
        defScript = arg[i];
      } else if (lowerArg.equals("-noexit")) {
        bMustExit = false;

        i--;
      } else {
        showUsage();

        return;
      }
    }

    DatabaseManagerSwing m = new DatabaseManagerSwing();

    m.main();

    Connection c = null;

    try {
      if (autoConnect) {
        c = ConnectionDialogSwing.createConnection(defDriver, defURL, defUser, defPassword);
      } else {
        c = ConnectionDialogSwing.createConnection(m.fMain, "Connect");
      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    if (c == null) {
      return;
    }

    m.connect(c);
  }