💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
![](https://box.kancloud.cn/6c3dc0cdb67068d987b2cd41e14a17f3_464x373.png) ![](https://box.kancloud.cn/21989e60281f90229415601cc789d0e5_291x200.png) ![](https://box.kancloud.cn/1c895bbed80ce9c2511a8eb9081646d8_360x254.png) ![](https://box.kancloud.cn/1b32aafb77a0e1b7d091ab8aa9357e3a_588x234.png) ![](https://box.kancloud.cn/936968fdab9b13e76231e1b817775b3b_555x300.png) ![](https://box.kancloud.cn/ede06725d98efaa6d18b4f57066ccbd4_466x220.png) ![](https://box.kancloud.cn/261b93dd3590ef829aea5da59078eba5_570x366.png) ![](https://box.kancloud.cn/2534604bd7f788c43c7381b34a67c68f_529x244.png) ![](https://box.kancloud.cn/67d25aa766a94c24abec62ba8dd1ef2b_397x178.png) ![](https://box.kancloud.cn/7929e351a6bdfca6216a4d4ee0e0abb2_768x258.png) user表 ~~~ CREATE TABLE `user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(20) DEFAULT NULL, `password` varchar(20) DEFAULT NULL, `email` varchar(50) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ~~~ ![](https://box.kancloud.cn/053fad083d0b191b607f2590f846b8e6_727x487.png) category表 ~~~ CREATE TABLE `category` ( `c_id` int(11) NOT NULL AUTO_INCREMENT, `c_name` varchar(50) DEFAULT NULL, `place` varchar(50) DEFAULT NULL, `createtime` date DEFAULT NULL, `type` tinyint(1) DEFAULT NULL, PRIMARY KEY (`c_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ~~~ 创建数据库连接文件和数据库对象文件 c3p0-config.xml ~~~ <?xml version="1.0" encoding="utf-8" ?> <c3p0-config> <!-- 默认配置,如果没有指定则使用这个配置 --> <default-config> <property name="driverClass">com.mysql.jdbc.Driver</property> <property name="jdbcUrl">jdbc:mysql://122.14.200.136:3306/javafresh</property> <property name="user">root</property> <property name="password">6a133f0024</property> <!-- 初始化池大小 --> <property name="initialPoolSize">5</property> <!-- 最大空闲时间 --> <property name="maxIdleTime">30</property> <!-- 最多有多少个连接 --> <property name="maxPoolSize">10</property> <!-- 最少几个连接 --> <property name="minPoolSize">5</property> <!-- 每次最多可以执行多少个批处理语句 --> <property name="maxStatements">50</property> </default-config> <!-- 命名的配置 --> <named-config name="51zixue"><!--这里是设置配置文件的名字--> <property name="driverClass">com.mysql.jdbc.Driver</property> <property name="jdbcUrl">jdbc:mysql://122.14.200.136:3306/javafresh</property> <property name="user">root</property><!--mysql的登陆名--> <property name="password">6a133f0024</property><!--如果没密码就可以设置成<property name="password"></property>--> <property name="acquireIncrement">5</property><!-- 如果池中数据连接不够时一次增长多少个 --> <property name="initialPoolSize">10</property> <property name="minPoolSize">5</property> <property name="maxPoolSize">15</property> <property name="maxStatements">0</property> <property name="maxStatementsPerConnection">5</property> <!-- he's important, but there's only one of him --> </named-config> </c3p0-config> ~~~ User.java ~~~ package zyw.bean; public class User { private int id; private String name; private String password; private String email; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } } ~~~ Category.java ~~~ package zyw.bean; import java.util.Date; public class Category { private int c_id; private String c_name; private String place; private Date createtime; private int type; public int getC_id() { return c_id; } public void setC_id(int c_id) { this.c_id = c_id; } public String getC_name() { return c_name; } public void setC_name(String c_name) { this.c_name = c_name; } public String getPlace() { return place; } public void setPlace(String place) { this.place = place; } public Date getCreatetime() { return createtime; } public void setCreatetime(Date createtime) { this.createtime = createtime; } public int getType() { return type; } public void setType(int type) { this.type = type; } } ~~~