- 作者:zhaozj
- 发表时间:2020-12-23 11:03
- 来源:未知
package connmysql; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; import com.borland.jbcl.layout.*; import javax.swing.event.*; //import org.gjt.mm.mysql.*; /** * <p>Title: Conn MySQL</p> * <p>Description: 连接MySql数据库</p> * <p>Copyright: Copyright (c) 2004</p> * <p>Company: 塞北的雪国际科技有限责任公司</p> * @author 塞北的雪 * @version 1.0 */ public class ConnMySQL extends JFrame { public static void main( String argc[]){ ConnMySQL tmp= new ConnMySQL(); tmp.pack() ; tmp.show() ; } JPanel contentPane; JLabel jLabel1 = new JLabel(); XYLayout xYLayout1 = new XYLayout(); JButton jButton1 = new JButton(); JTextArea jTextArea1 = new JTextArea(); JTextField jTextField1 = new JTextField(); JButton jButton3 = new JButton(); JButton jButton2 = new JButton(); Button TextClear = new Button(); //定义全局变量 //定义连接数据库时候的一些属性 public String DBUser = "root"; public String DBPassword = ""; public String DBName = "sbdx"; public Connection conn; public Statement sqlStmt; public ResultSet sqlRst; //End //Construct the frame public ConnMySQL() { enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { jbInit(); jButton3.setEnabled( false); } catch (Exception e) { e.printStackTrace(); } } //Component initialization private void jbInit() throws Exception { contentPane = (JPanel)this.getContentPane(); jLabel1.setFont( new