ImageVerifierCode 换一换
格式:DOCX , 页数:28 ,大小:56.40KB ,
资源ID:27589110      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/27589110.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(学生管理系统java实现.docx)为本站会员(b****8)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

学生管理系统java实现.docx

1、学生管理系统java实现学生管理系统java实现准备的软件,我用是 eclipse.exe, MySql,还有mysql jdbc 5.0数据库。网上很容易找到华 军上就有的。第一步,安装 eclipse.exe, MySql。 MySql的密码请设置为 123,因为我的程序上的密码就是123。以后你看懂了可以修改的!把下载的mysql jdbc 5.0数据库.zip通常是个压缩包解压到一个地方。然后运行 eclipse.exe。建立个项目,名字自己随便叫即可。然后在菜单栏上 Project就是Run旁边的那个菜单,按 下左键选择Properties就是最下面的一项。选择 Java Build

2、 Path。在对话框的右面出现个小 窗体,选Libraries。选择 Add External JARs.。选择你 mysql jdbc 5.0 数据库,解压出来的 mysql-c onn ector-java-5.0.0-beta-b in .jar 也许名字有出入。如下面的图添加完成后就是这个样子了第二步 安装Mysql数据库 请把密码设置为123就是带password的地方。我的程序上密 码设置就是123为了运行方便。然后运行Mysql执行下面四个步骤贏 MySQL Command Line ClientEn teP *7e leone to the JISQL nanitor, Gom

3、nAnd end wit our* MySQL connect ion id is 15Seiner vers ion : S _ 0_6?-coinniuriity-nt tlySQIr Gommurrype Jhelp;* or h for help, Type y to eleccreate datscxdb;nsqi / rnieql ruitsql nysql rnsql mysql mysql use scxdb;nysqT?Lyeql rnysijLy create table studentK nvmbep irit, - nne charf LAnguasfe int, rt

4、ath lnt - enlish int, - birthdav dat&;.ijitih4 elwirigilUiert 坯切 ttvdent TiWe许LW J fft”初9出 J 即J沾阳刖 l Jt .四部的命令分别是1。 create database scxdb;2。 use scxdb;3。 create table student( nu mber int,n ame char(8),Ian guage int,math int, english int, birthday date);4。insert into student values(1717,曹操,80,90,20,

5、1985-01-01); 下面是程序清单!/=第一部分package DBTest;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JFrame;import javax.swing.JMenu;import javax.swing.JMenuBar;import javax.swing.JMenuItem;import javax.swing.JScrollPane;import javax.swing.JTable;public class DBFrame /

6、* param args*/public static void main(String args) / TODO Auto-generated method stubString sql = select * from student;/ sql=insert into student values/ (1717,张云风 ,56,80,65,1979-02-16);DBFrameWindow db = new DBFrameWindow(sql); db.setDefaultCloseOperation(db.EXIT_ON_CLOSE); db.setVisible(true);db.se

7、tResizable(false);class DBFrameWindow extends JFrame public DBFrameWindow(String sql) super.setTitle(DBFrameWindow); this.sql=sql;this.setSize(500, 380);JTable table = DBHander.getTable(this.sql);scroolPane = new JScrollPane(table); this.add(scroolPane);/ =JMenu runMenu = new JMenu(Run);JMenuBar mb

8、= new JMenuBar();mb.add(runMenu);this.setJMenuBar(mb); /=Append=Append= JMenuItem appendItem = new JMenuItem(Append); appendItem.addActionListener(new ActionListener() Overridepublic void actionPerformed(ActionEvent e) / TODO Auto-generated method stub appendFrame af = new appendFrame(); af.setDefau

9、ltCloseOperation(af.EXIT_ON_CLOSE); af.setVisible(true);af.setResizable(false); DBHander.getUpdataTest(););/=Append=Append=/=Remove=Remove= JMenuItem removeItem = new JMenuItem(Remove);removeItem.addActionListener(new ActionListener()Overridepublic void actionPerformed(ActionEvent arg0) / TODO Auto-

10、generated method stub removeFrame rf=new removeFrame(); rf.setDefaultCloseOperation(rf.EXIT_ON_CLOSE); rf.setResizable(false);rf.setVisible(true););/=Remove=Remove=/=Update=Update JMenuItem updateItem = new JMenuItem(Update); updateItem.addActionListener(new ActionListener()public void actionPerform

11、ed(ActionEvent e) / TODO Auto-generated method stub updateFrame uf = new updateFrame(); uf.setDefaultCloseOperation(uf.EXIT_ON_CLOSE); uf.setResizable(false);uf.setVisible(true););/=Update=Update=/=Find=Find= JMenuItem findItem = new JMenuItem(Find);findItem.addActionListener(new ActionListener()Ove

12、rridepublic void actionPerformed(ActionEvent arg0) / TODO Auto-generated method stub selectFrame sf = new selectFrame(); sf.setDefaultCloseOperation(sf.EXIT_ON_CLOSE); sf.setResizable(false);sf.setVisible(true););/=Find=Find= JMenuItem refreshItem = new JMenuItem(Refresh); refreshItem.addActionListe

13、ner(new ActionListener() Overridepublic void actionPerformed(ActionEvent arg0) / TODO Auto-generated method stubJTable ta=DBHander.getTable(select * from student;); JScrollPane scroolPane_1=new JScrollPane(ta);add(scroolPane_1);System.out.println(refreshItem););runMenu.add(appendItem); runMenu.add(r

14、emoveItem);runMenu.add(updateItem); runMenu.add(findItem);runMenu.add(refreshItem);/ = private JScrollPane scroolPane = null; private String sql=;/=/=第二部分package DBTest;import java.io.UnsupportedEncodingException;import java.sql.Connection;import java.sql.PreparedStatement;import java.sql.ResultSet;

15、import java.sql.ResultSetMetaData;import java.sql.SQLException;import java.sql.Statement;import javax.swing.JTable;import com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource;public class DBHander /* param args*/public static void main(String args) / TODO Auto-generated method stubString sql

16、= insert into student values (1717, 张云风 ,56,80,65,1979-02-16); Connection conn = getConnection();if (conn = null) System.out.println(conn=null); else System.out.println(conn!=null);Statement stat = getStatement();if (stat = null) System.out.println(stat=null); else System.out.println(stat!=null);Res

17、ultSet rs = getResult(select * from student;);if (rs = null) System.out.println(rs=null); else System.out.println(rs!=null);JTable table = getTable(select * from student;); if (rs = null) System.out.println(table=null); else System.out.println(table!=null);private static String select=null;/ = Conne

18、ction = public static Connection getConnection() MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource(); ds.setUrl(jdbc:MySQL:/localhost/scxdb);ds.setUser(root); ds.setPassword(123);try return ds.getConnection(); catch (SQLException e) / TODO Auto-generated catch block e.printStackTr

19、ace(); System.out.println(conn=null);return null;/ = Connection/ = Statement public static Statement getStatement() Connection conn = DBHander.getConnection();try return conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDA TABLE); catch (SQLException e) / TODO Auto-generated

20、catch blocke.printStackTrace();System.out.println(stat=null);return null;/ = Statement/ = ResultSetpublic static ResultSet getResult(String sql) try return getStatement().executeQuery(sql); catch (SQLException e) / TODO Auto-generated catch block e.printStackTrace();System.out.println(table=null);re

21、turn null;/ = ResultSet/ = getTable public static JTable getTable(String sql) ResultSet rs = null;String str = null;int cols = 0;try rs = getResult(sql);ResultSetMetaData md = rs.getMetaData();cols = md.getColumnCount();int n = 0;while (rs.next() n = n + 1;str = new Stringncols; catch (SQLException

22、e) / TODO Auto-generated catch block e.printStackTrace();rs = getResult(sql);int n = 0;try while (rs.next() for (int i = 0; i cols; i+) / strni=rs.getString(i+1);strni = new String(rs.getString(i + 1).getBytes( iso-8859-1), GBK);n = n + 1; catch (SQLException e) / TODO Auto-generated catch block e.p

23、rintStackTrace(); catch (UnsupportedEncodingException e) / TODO Auto-generated catch block e.printStackTrace();String s = new String Number, Name, Language, Math, English, Birthday ; JTable table = new JTable(str, s);for (int i = 0; i str.length; i+) for (int j = 0; j stri.length; j+)System.out.prin

24、t(strij + );System.out.println();select=str;return table;/ = getTable =public static void getUpdataTest(String sql)try Connection conn=getConnection();if(conn=null) System.out.println(null);? WHEREPreparedStatement ps=conn.prepareStatement(UPDA TE student SET number = number=?;);ps.setString(1,2088)

25、;ps.setString(2,1717);System.out.println(#); catch (SQLException e) / TODO Auto-generated catch blocke.printStackTrace();/ = getUpdata = public static void getUpdate(String sql) Statement stat;try stat = getConnection().createStatement();int n = stat.executeUpdate(sql);System.out.println(* + n + *);

26、 catch (SQLException e) / TODO Auto-generated catch block e.printStackTrace();/ = getUpdata/ = getSelectpublic static String getSelect(String sql) getTable(sql);if(select=null) System.out.println(select=null); return select;/ = getSelect =/=/=第 3 部分package DBTest;import java.awt.BorderLayout;import java.awt.GridLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.io.UnsupportedEncodingException;im

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1