Java学生管理系统项目案例分析_极悦注册
专注Java教育14年 全国咨询/投诉热线:444-1124-454
极悦LOGO图
始于2009,口口相传的Java黄埔军校
首页 学习攻略 Java学习 Java学生管理系统项目案例分析

Java学生管理系统项目案例分析

更新时间:2022-06-17 10:33:42 来源:极悦 浏览932次

以下是Java学生管理系统项目的源码分析:

package com.student.util; 
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException; 
public class DbUtil {
        private String dbUrl="jdbc:mysql://localhost:3306/db_student";
        private String user="root";
        private String password="123456";
        private String jdbcName="com.mysql.jdbc.Driver";
        public Connection getCon() throws Exception{
                Class.forName(jdbcName);
                Connection con=DriverManager.getConnection(dbUrl, user, password);
                return con;
        }
        public void close(Connection con)throws Exception{
                if(con!=null){
                        con.close();
                }
        }
        public static void main(String[] args){
                Connection con=null;
                try {
                        con = new DbUtil().getCon();
                        System.out.println(con);
                } catch (Exception e) {
                        e.printStackTrace();
                }finally{
                        if(con!=null){
                                try {
                                        con.close();
                                } catch (SQLException e) {
                                        e.printStackTrace();
                                }
                        }
                }
        }
}
package com.student.model; 
public class Student {
        private int id;
        private String studentnumber;
        private String name;
        private String birthday;
        private String nativeplace;
        private int classid;
        private String studentremark;
        public Student() {
                super();
        }
        public Student(String studentnumber, String name, String birthday,
                        String nativeplace, int classid, String studentremark) {
                super();
                this.studentnumber = studentnumber;
                this.name = name;
                this.birthday = birthday;
                this.nativeplace = nativeplace;
                this.classid = classid;
                this.studentremark = studentremark;
        } 
        public Student(int id, String studentnumber, String name, String birthday,
                        String nativeplace, int classid, String studentremark) {
                super();
                this.id = id;
                this.studentnumber = studentnumber;
                this.name = name;
                this.birthday = birthday;
                this.nativeplace = nativeplace;
                this.classid = classid;
                this.studentremark = studentremark;
        } 
        public int getId() {
                return id;
        } 
        public void setId(int id) {
                this.id = id;
        } 
        public String getStudentnumber() {
                return studentnumber;
        }
        public void setStudentnumber(String studentnumber) {
                this.studentnumber = studentnumber;
        } 
        public String getName() {
                return name;
        } 
        public void setName(String name) {
                this.name = name;
        } 
        public String getBirthday() {
                return birthday;
        } 
        public void setBirthday(String birthday) {
                this.birthday = birthday;
        } 
        public String getNativeplace() {
                return nativeplace;
        } 
        public void setNativeplace(String nativeplace) {
                this.nativeplace = nativeplace;
        } 
        public int getClassid() {
                return classid;
        }
         public void setClassid(int classid) {
                this.classid = classid;
        } 
        public String getStudentremark() {
                return studentremark;
        } 
        public void setStudentremark(String studentremark) {
                this.studentremark = studentremark;
        } 
}

 

提交申请后,顾问老师会电话与您沟通安排学习

免费课程推荐 >>
技术文档推荐 >>