コード例 #1
0
  /** Method declaration */
  public void init() {

    DatabaseManager m = new DatabaseManager();

    m.main();

    try {
      m.connect(ConnectionDialog.createConnection(defDriver, defURL, defUser, defPassword));
      m.insertTestData();
      m.refreshTree();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
コード例 #2
0
  /**
   * Method declaration
   *
   * @param arg
   */
  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++;

      if (i == arg.length) {
        showUsage();

        return;
      }

      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 {
        showUsage();

        return;
      }
    }

    bMustExit = true;

    DatabaseManager m = new DatabaseManager();

    m.main();

    Connection c = null;

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

    if (c == null) {
      return;
    }

    m.connect(c);
  }