⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 educesql_fpg_3.java

📁 一些平时可能用到的工具,比如导出数据,比较数据
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
							.setText("\u5c07\u7570\u52d5\u4eba\u54e1\u66ff\u63db\u70ba\u672c\u6a5f\u80fd\u4eba\u54e1");
					chkTxemp.setBounds(140, 175, 203, 21);
				}
				{
					labDB = new JLabel();
					jPanel1.add(labDB);
					labDB.setText("DB");
					labDB.setBounds(371, 14, 49, 28);
				}
				{
					ComboBoxModel cbxDBModel = new DefaultComboBoxModel(dbname);
					cbxDB = new JComboBox();
					jPanel1.add(cbxDB);
					cbxDB.setModel(cbxDBModel);
					cbxDB.setBounds(420, 14, 126, 28);
					cbxDB.setEditable(false);
					cbxDB.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							// "本地","昆山Demo","繁體Demo","簡體Demo","TPFNC11",
							// "台灣基本版","大陸基本版","永日","九德","國精","振農","梅蘭","振峰"
							// ,"宏益","剛健","宏福","大園","先創","怡球","開源","石安","邦拓","邦特测試區","龍璟"
							// ,"龍璟测試區","利簾臺灣版","利簾大陸版","特偉"
							String host = "";
							String port = "1521";
							String sid = "";
							String username = "";
							String passwd = "";
							int i = cbxDB.getSelectedIndex() - 1;
							switch (i) {
							case -1:
								// HOST=cdfn01 SID=cdfn01
								host = "cdfn01";
								sid = "cdfn01";
								username = "u1?p2";
								passwd = "u1?p2";
								break;
							case 0:
								// HOST=qsfn01 SID=qsfn01u
								host = "qsfn01";
								sid = "qsfn01u";
								username = "u1?p";
								passwd = "u1?p";
								break;
							case 1:
								// HOST=tpfn21 SID=tpfn21
								host = "tpfn21";
								sid = "tpfn21";
								username = "u1?p1";
								passwd = "u1?p1";
								break;
							case 2:
								// HOST=qsfn02 SID=qsfn02
								host = "qsfn02";
								sid = "qsfn02";
								username = "u1?p";
								passwd = "u1?p";
								break;
							case 3:
								// HOST=tpfnc12 SID=tpfnc12
								host = "tpfnc12";
								sid = "tpfnc12";
								username = "u1?p";
								passwd = "u1?p";
								break;
							case 4:
								// HOST=172.24.5.13 SID=tpfn21
								host = "172.24.5.13";
								sid = "tpfn21";
								username = "u1?p2";
								passwd = "u1?p2";
								break;
							case 5:
								// HOST=172.24.5.13 SID=tpfn21
								host = "172.24.5.13";
								sid = "tpfn21";
								username = "ucn?p";
								passwd = "ucn?p";
								break;
							case 6:
								// HOST=172.21.1.18 SID=erptest
								host = "172.21.1.18";
								sid = "erptest";
								username = "u2?p";
								passwd = "u2?p";
								break;
							case 7:
								// HOST=172.21.1.34 SID=db2
								host = "172.21.1.34";
								sid = "db2";
								username = "u1?p";
								passwd = "u1?p";
								break;
							case 8:
								// HOST=172.21.1.49 SID=qpcr6t
								host = "172.21.1.49";
								sid = "qpcr6t";
								username = "u1?p";
								passwd = "u1?p";
								break;
							case 9:
								// HOST=172.21.1.71 SID=tlwht
								host = "172.21.1.71";
								sid = "tlwht";
								username = "u1?p";
								passwd = "u1?p";
								break;
							case 10:
								// ?
								host = "";
								sid = "";
								username = "u1?p";
								passwd = "u1?p";
								break;
							case 11:
								// HOST=172.21.1.81 SID=yokedbt
								host = "172.21.1.81";
								sid = "yokedbt";
								username = "u1?p";
								passwd = "u1?p";
								break;
							case 12:
								// HOST=172.21.1.146 SID=erpdbt
								host = "172.21.1.146";
								sid = "erpdbt";
								username = "u1?p";
								passwd = "u1?p";
								break;
							case 13:
								// HOST = 172.21.1.225 SID = gjora
								host = "172.21.1.225";
								sid = "gjora";
								username = "u1?p";
								passwd = "u1?p";
								break;
							case 14:
								// ?
								host = "192.168.0.234";
								sid = "hfdbt";
								username = "u1?p";
								passwd = "u1?p";
								break;
							case 15:
								// HOST = 172.21.2.2 SID = tycdb
								host = "172.21.2.2";
								sid = "tycdb";
								username = "u1?p";
								passwd = "u1?p";
								break;
							case 16:
								// ?
								host = "";
								sid = "";
								username = "u1?p";
								passwd = "u1?p";
								break;
							case 17:
								// ?
								host = "";
								sid = "";
								username = "u1?p";
								passwd = "u1?p";
								break;
							case 18:
								// HOST=172.21.1.71 SID=tlwh
								host = "172.21.1.71";
								sid = "tlwh";
								username = "u2?p";
								passwd = "u2?p";
								break;
							case 19:
								// 主機名稱 : SANDB
								// IP : 172.21.2.18
								// ORACLE SID : SANDB
								host = "172.21.2.18";
								sid = "SANDB";
								username = "u1?p";
								passwd = "u1?p";
								break;
							case 20:
								// 主機名稱 : FPG100
								// IP : 172.21.2.33
								// ORACLE SID : FPG100
								host = "172.21.2.33";
								sid = "FPG100";
								username = "u1?p";
								passwd = "u1?p";
								break;
							case 21:
								// 主機名稱 : FPG100T
								// IP : 172.21.2.33
								// ORACLE SID : FPG100T
								host = "172.21.2.33";
								sid = "FPG100T";
								username = "u1?p";
								passwd = "u1?p";
								break;
							case 22:
								// 主機名稱 :
								// IP : 192.168.14.103
								// ORACLE SID : erpdb
								host = "192.168.14.103";
								sid = "erpdb";
								username = "u1?p";
								passwd = "u1?p";
								break;
							case 23:
								// 主機名稱 :
								// IP : 192.168.14.103
								// ORACLE SID : erpdbt
								host = "192.168.14.103";
								sid = "erpdbt";
								username = "u1?p";
								passwd = "u1?p";
								break;
							case 24:
								// 主機名稱 :
								// IP :192.168.1.80
								// ORACLE SID : abcdb
								host = "192.168.1.80";
								sid = "abcdb";
								username = "u1?p";
								passwd = "u1?p";
								break;
							case 25:
								// 主機名稱 :
								// IP : 192.168.1.80
								// ORACLE SID : abcdb
								host = "192.168.1.80";
								sid = "abcdb";
								username = "u2?p";
								passwd = "u2?p";
								break;
							case 26:
								// 主機名稱 : E147DB
								// IP : 172.21.2.50
								// ORACLE SID : E147DB
								host = "172.21.2.50";
								sid = "E147DB";
								username = "u1?p";
								passwd = "u1?p";
								break;
							case 27:
								// 主機名稱 : E147DB
								// IP : 172.21.2.50
								// ORACLE SID : E147DB
								host = "tpfn09";
								sid = "tpfn09";
								username = "pdu1";
								passwd = "sanctuary";
								break;
							case 28:
								// 主機名稱 : E147DB
								// IP : 172.21.2.50
								// ORACLE SID : E147DB
								host = "10.232.226.63";
								sid = "xe";
								username = "jiudian";
								passwd = "jiudian";
								break;
							default:
								break;
							}
							txtHost.setText(host);
							txtPort.setText(port);
							txtSid.setText(sid);
							txtUsername.setText(username);
							txtPassword.setText(passwd);
						}
					});
				}
				{
					chkLOCAL = new JCheckBox();
					jPanel1.add(chkLOCAL);
					chkLOCAL
							.setText("\u4f7f\u7528\u672c\u5730\u8868\u7684VIEW");
					chkLOCAL.setBounds(350, 175, 196, 21);
				}
			}
			pack();
			this.setSize(558, 244);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public boolean Conn() {
		username = txtUsername.getText();
		password = txtPassword.getText();
		host = txtHost.getText();
		port = txtPort.getText();
		sid = txtSid.getText();
		try {
			Class.forName("oracle.jdbc.driver.OracleDriver");
			con = DriverManager.getConnection("jdbc:oracle:thin:@" + host + ":"
					+ port + ":" + sid, username, password);
		} catch (ClassNotFoundException e) {
			System.out.println("载入数据驱动出错!!!!!!");
			errmsg.append("载入数据驱动出错!!!!!!");
			txtMsg.setText("载入数据驱动出错!!!!!!\n");
			e.printStackTrace();
			return false;
		} catch (SQLException e) {
			e.printStackTrace();
			if (e.toString().contains("ORA-12505")) {
				System.out.println("数据库未启动!!!!");
				errmsg.append("数据库未启动!!!!");
				txtMsg.setText("数据库未启动!!!!");
				return false;
			} else if (e.toString().contains("ORA-12528")
					|| e.toString().contains("ORA-01033")) {
				System.out.println("数据库正在启动!!!!");
				errmsg.append("数据库正在启动!!!!");
				txtMsg.setText("数据库正在启动!!!!");
				return false;
			} else if (e.toString().contains("ORA-01017")) {
				System.out.println("用户或密码错误!!!!");
				errmsg.append("用户或密码错误!!!!");
				txtMsg.setText("用户或密码错误!!!!");
				return false;
			} else if (e.toString().contains(
					"The Network Adapter could not establish the connection")) {
				System.out.println("数据库未启动!!!!");
				errmsg.append("数据库未启动!!!!");
				txtMsg.setText("数据库未启动!!!!");
				return false;
			} else {
				System.out.println("未知错误!!!!");
				errmsg.append("未知错误!!!!");
				txtMsg.setText("未知错误!!!!");
				return false;
			}
		}
		return true;
	}

	public boolean localcon() {
		// XD
		if (str_table.charAt(2) == 'D') {
			username = "ERP2";
			password = "ERP2";
		}
		// XF
		if (str_table.charAt(2) == 'F') {
			username = "ERPCN";
			password = "ERPCN";
		}
		try {
			Class.forName("oracle.jdbc.driver.OracleDriver");
			localcon = DriverManager.getConnection("jdbc:oracle:thin:@"
					+ "cdfn01" + ":" + "1521" + ":" + "cdfn01", username,
					password);
		} catch (ClassNotFoundException e) {
			System.out.println("载入数据驱动出错!!!!!!");
			errmsg.append("载入数据驱动出错!!!!!!");
			txtMsg.setText("载入数据驱动出错!!!!!!\n");
			e.printStackTrace();
			return false;
		} catch (SQLException e) {
			e.printStackTrace();
			if (e.toString().contains("ORA-12505")) {
				System.out.println("数据库未启动!!!!");
				errmsg.append("数据库未启动!!!!");
				txtMsg.setText("数据库未启动!!!!");
				return false;
			} else if (e.toString().contains("ORA-12528")
					|| e.toString().contains("ORA-01033")) {
				System.out.println("数据库正在启动!!!!");
				errmsg.append("数据库正在启动!!!!");
				txtMsg.setText("数据库正在启动!!!!");
				return false;
			} else if (e.toString().contains("ORA-01017")) {
				System.out.println("用户或密码错误!!!!");
				errmsg.append("用户或密码错误!!!!");
				txtMsg.setText("用户或密码错误!!!!");
				return false;
			} else if (e.toString().contains(
					"The Network Adapter could not establish the connection")) {
				System.out.println("数据库未启动!!!!");
				errmsg.append("数据库未启动!!!!");
				txtMsg.setText("数据库未启动!!!!");
				return false;
			} else {
				System.out.println("未知错误!!!!");
				errmsg.append("未知错误!!!!");
				txtMsg.setText("未知错误!!!!");
				return false;
			}
		}
		return true;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -