人口估算java_Java web人口普查系统-java代码

bean层

package 人口普查系统;

public class Bean {

private int id;

private String hubie;

private String livetype;

private int area;

private int roomnum;

private String name;

private String idcard;

private String sex;

private String nation;

private String education;

public int getId() {

return id;

}

public void setId(int id) {

this.id = id;

}

public String getHubie() {

return hubie;

}

public void setHubie(String hubie) {

this.hubie = hubie;

}

public String getLivetype() {

return livetype;

}

public void setLivetype(String livetype) {

this.livetype = livetype;

}

public int getArea() {

return area;

}

public void setArea(int area) {

this.area = area;

}

public int getRoomnum() {

return roomnum;

}

public void setRoomnum(int roomnum) {

this.roomnum = roomnum;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public String getIdcard() {

return idcard;

}

public void setIdcard(String idcard) {

this.idcard = idcard;

}

public String getSex() {

return sex;

}

public void setSex(String sex) {

this.sex = sex;

}

public String getNation() {

return nation;

}

public void setNation(String nation) {

this.nation = nation;

}

public String getEducation() {

return education;

}

public void setEducation(String education) {

this.education = education;

}

public Bean(int id, String hubie, String livetype, int area, int roomnum, String name, String idcard,String sex, String nation, String education) {

this.id = id;

this.hubie = hubie;

this.livetype = livetype;

this.area = area;

this.roomnum = roomnum;

this.name = name;

this.idcard = idcard;

this.sex = sex;

this.nation = nation;

this.education = education;

}

public String toString() {

return "Census{" +

"id=" + id +

", hubie='" + hubie + '\'' +

", livetype='" + livetype + '\'' +

", area=" + area +

", roomnum=" + roomnum +

", name='" + name + '\'' +

", idcard='" + idcard + '\'' +

", sex='" + sex + '\'' +

", nation='" + nation + '\'' +

", education='" + education + '\'' +

'}';

}

}

DBUtil//链接数据库层

package 人口普查系统;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

public class DBUtil {

private static String url = "jdbc:mysql://localhost:3306/course?serverTimezone=UTC";

private static String user = "root";

private static String password = "123456";

private static String jdbcName="com.mysql.jdbc.Driver";

private Connection con=null;

public static Connection getConnection() {

Connection con=null;

try {

Class.forName(jdbcName);

con=DriverManager.getConnection(url, user, password);

//System.out.println("鏁版嵁搴撹繛鎺ユ垚鍔�");

} catch (Exception e) {

// TODO Auto-generated catch block

//System.out.println("鏁版嵁搴撹繛鎺ュけ璐�");

e.printStackTrace();

}

try {

con = DriverManager.getConnection(url,user,password);

System.out.println("杩炴帴鎴愬姛");

} catch (SQLException e) {

// TODO: handle exception

e.printStackTrace();

}

return con;

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值