前言: 以下是Java学生管理系统项目的源码分析: package com.student.util; import java.sql.Connection;import java.sql.DriverManager;import java
以下是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;
}
}
文章出自:http://qh.itpxw.cn/peixun/software/2022123691.html
文章标题:Java学生管理系统项目案例分析
免责声明:本站文章均由入驻起航学习网的会员所发或者网络转载,所述观点仅代表作者本人,不代表起航学习网立场。如有侵权或者其他问题,请联系举报,必删。侵权投诉
IT培训网 访问该机构站点 报名留言 加为好友 用户等级:注册会员
用户级别:10
机构名称:IT培训网
联 系 人:罗老师
联系电话:13783581536
联系手机:13783581536
在线客服:
在 线 QQ:
电子邮件:
网站域名:http://www.itpxw.cn
注册时间:2016-07-18 11:07
最后登录:2024-02-20 13:02
Java定义方法的格式是什么?IT培训网小编来告诉大家。所谓方法...
大家在Java教程中会学到关于Java消息推送的知识,那么,Java消息...
常用的Java日期格式转换有哪些?IT培训网小编来告诉大家。 1...
Java创建对象数组的方法是什么?IT培训网小编来告诉大家。Ja...