JDBC 链接数据库
- 首先,建立一个简单的数据库
people
,创建一张测试表student
CREATE TABLE `student` (
`id` int(4) PRIMARY KEY,
`name` VARCHAR(20),
`age` int(8),
`password` VARCHAR(20),
`email` VARCHAR(40),
`tel` VARCHAR(20)
);
INSERT INTO `student`(`id`, `name`, `age`, `password`, `email`, `tel`) VALUES
(1, '孙二', 18, '123456', '[email protected]', '8339564'),
(2, '张三', 24, '465456564', '[email protected]', '8334654'),
(3, '李四', 35, 'sdfds45', '[email protected]', '8356485'),
(4, '王五', 12, '453544', '[email protected]', '8953456'),
(5, '赵六', 10, '4534533', '[email protected]', '8775412');
创建好之后 student
表如下所示