java jdbc 项目_java高级项目 jdbc与数据库连接数据库

//图书管类

public class Book {

private Integer id;

private String b_name;

private double b_price;

private Integer b_number;

private Date b_date;

//无参构造方法

public Book() {

super();

// TODO Auto-generated constructor stub

}

public Book(Integer id, String b_name, double b_price, Integer b_number, Date b_date) {

this.id = id;

this.b_name = b_name;

this.b_price = b_price;

this.b_number = b_number;

this.b_date = b_date;

}

public Book( String b_name, double b_price, Integer b_number,Date b_date) {

this.b_name = b_name;

this.b_price = b_price;

this.b_number = b_number;

this.b_date=b_date;

}

public Integer getId() {

return id;

}

public void setId(Integer id) {

this.id = id;

}

public String getB_name() {

return b_name;

}

public void setB_name(String b_name) {

this.b_name = b_name;

}

public double getB_price() {

return b_price;

}

public void setB_price(double b_price) {

this.b_price = b_price;

}

public Integer getB_number() {

return b_number;

}

public void setB_number(Integer b_number) {

this.b_number = b_number;

}

public Date getB_date() {

return b_date;

}

public void setB_date(Date b_date) {

this.b_date = b_date;

}

@Override

public String toString() {

return this.id+"\t"+this.b_name+"\t"+this.b_price+"\t"+this.b_number

+"\t"+this.b_date;

}

}

//用户类

public class MyUser {

private Integer id;

private String u_name;

private String u_pass;

public MyUser() {

super();

// TODO Auto-generated constructor stub

}

public MyUser(Integer id,String u_name, String u_pass) {

this.id = id;

this.u_name = u_name;

this.u_pass = u_pass;

}

public MyUser(String u_name, String u_pass) {

this.u_name = u_name;

this.u_pass = u_pass;

}

public Integer getId() {

return id;

}

public void setId(Integer id) {

this.id = id;

}

public String getU_name() {

return u_name;

}

public void setU_name(String u_name) {

this.u_name = u_name;

}

public String getU_pass() {

return u_pass;

}

public void setU_pass(String u_pass) {

this.u_pass = u_pass;

}

@Override

public String toString() {

// TODO Auto-generated method stub

return this.id+"\t"+this.u_name+"\t"+this.u_pass;

}

}

//图书接口

public interface Bookdao {

public abstract boolean add(Book b);

public abstract boolean del(Integer id);

public abstract boolean change(Integer id,double price);

public abstract Book find(Integer id);

public abstract ListfindAll();

}

//用户接口

public interface MyUserDao {

//根据id与密码来进行登录

public abstract MyUser find(String name,String u_pass);

//注册

public abstract boolean register(MyUser my);

}

//jdbc工具类,注册驱动获取连接数据库对象 释放资源

ublic class jdbcUtils {

//定义初始化

private static String urls;

private static String users;

priv

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值