public void actionPerformed(ActionEvent e) {
			String name, address, port, username, password;
			InputFormatValidator v = new InputFormatValidator();

			name = main.getName();
			address = main.getAddress();
			port = main.getPort();
			username = main.getUsername();
			password = main.getPassword();

			// make sure every map and list are empty
			mapButtonLabel.clear();
			mapButtonCombo.clear();
			mapButtonNary.clear();
			mapButtonRelationName.clear();
			cycleCombo.clear();
			nary.clear();
			cycles.clear();
			splitThis.clear();
			naryPanelExist = false;

			if (name.isEmpty() || address.isEmpty() || port.isEmpty()
					|| username.isEmpty() || password.isEmpty()) {
				main.setErrorMsg("Please enter all the fields");
			} else {
				// validate name add port.
				if (v.validateName(name) && v.validatePort(port)) {
					try {
						r.connectToDB(address, port, name, username, password);
						dbname = name;
						main.emptiedField();
						main.setErrorMsg(" ");

						choice.cleanUp();

						r.translateToERD();
						cycles = r.checkCycle();

						// set up the choice panel
						Map<String, ErdNode> rootMap = r.getERDEntityTypes();
						List<String> rootTemp = new ArrayList<String>(
								rootMap.keySet());
						List<String> rootEntity = new ArrayList<String>();
						for (int i = 0; i < rootTemp.size(); i++) {
							if (rootMap.get(rootTemp.get(i)).getErdNodeType() == ErdNodeType.ENTITY_TYPE) {
								rootEntity.add(rootTemp.get(i));
							}
						}

						for (int i = 0; i < cycles.size(); i++) {
							List<String> currC = cycles.get(i);
							if (currC.get(0).equals("0")) {
								for (int q = 2; q < currC.size(); q++) {
									splitThis.add(currC.get(q));
								}
							}
						}

						rootEntity.removeAll(splitThis);

						String[] root = rootEntity.toArray(new String[0]);
						choice.setRootList(root);

						choice.addNextCancelButton();
						main.getMainFrame().setContentPane(
								main.getChoicePanel());
						main.getMainFrame().validate();
					} catch (MainException me) {
						main.setErrorMsg(me.getMessage());
						me.printStackTrace();
					}
				} else {
					if (!v.validateName(name)) {
						main.setErrorMsg("Invalid database name");
					} else if (!v.validatePort(port)) {
						main.setErrorMsg("Invalid port number");
					}
				}
			}

		}