当前位置: 移动技术网 > IT编程>开发语言>Java > 基于Java的GUI的图书馆管理系统(源码+数据库+无论文)

基于Java的GUI的图书馆管理系统(源码+数据库+无论文)

2020年07月07日  | 移动技术网IT编程  | 我要评论

部分数据库
CREATE TABLE tb_bookinfo (
ISBN varchar(20) DEFAULT NULL,
typeid varchar(20) DEFAULT NULL,
writer varchar(20) DEFAULT NULL,
translator varchar(20) DEFAULT NULL,
publisher varchar(20) DEFAULT NULL,
date datetime DEFAULT NULL,
price double DEFAULT NULL,
bookname varchar(40) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

/*Data for the table tb_bookinfo */

insert into tb_bookinfo(ISBN,typeid,writer,translator,publisher,date,price,bookname) values (‘1111111111111’,‘2’,‘出版人’,‘哈哈’,’***出版社’,‘2013-04-24 00:00:00’,20,‘java开发’);

/*Table structure for table tb_booktype */

DROP TABLE IF EXISTS tb_booktype;

CREATE TABLE tb_booktype (
id int(11) NOT NULL AUTO_INCREMENT,
typeName varchar(20) DEFAULT NULL,
days varchar(20) DEFAULT NULL,
fk varchar(20) DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

public class Dao {
	protected static String dbClassName = "com.mysql.jdbc.Driver";
	protected static String dbUrl = "jdbc:mysql://localhost:3306/db_library";
	protected static String dbUser = "root";
	protected static String dbPwd = "1234";
	protected static String second = null;
	private static Connection conn = null;
	
	private Dao() {
		try {
			if (conn == null) {
				Class.forName(dbClassName).newInstance();
				conn = DriverManager.getConnection(dbUrl, dbUser, dbPwd);
			}
			else
				return;
		} catch (Exception ee) {
			ee.printStackTrace();
		}

	}
	private static ResultSet executeQuery(String sql) {
		try {
			if(conn==null)
			new Dao();
			return conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE).executeQuery(sql);
		} catch (SQLException e) {
			e.printStackTrace();
			return null;
		} finally {
		}
	}

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

本文地址:https://blog.csdn.net/qq_43708988/article/details/107166003

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网