摘要: driver=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/shujuku?&useUnicode=true&serverTimezone=UTC username=root password=123456 #初始化连接数 initial 阅读全文
posted @ 2021-11-04 22:30 软工小蜗牛 阅读(89) 评论(0) 推荐(0)
摘要: import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.druid.pool.DruidDataSourceFactory; import java.io.IOException; import java.io.InputS 阅读全文
posted @ 2021-11-04 22:29 软工小蜗牛 阅读(620) 评论(0) 推荐(0)
摘要: 在servlet层时设置 @WebServlet("/getServlet1")此时为servlet的注释 在html中配置form 的 action属性时 要将你的本地服务端地址一并输入例如 <form action="/MySQL_war_exploded/getServlet1" method 阅读全文
posted @ 2021-11-04 15:28 软工小蜗牛 阅读(184) 评论(0) 推荐(0)
摘要: div标签 span标签 p标签 阅读全文
posted @ 2021-11-03 17:00 软工小蜗牛 阅读(94) 评论(0) 推荐(0)
摘要: input tpye = file //文件上传 input tpye = hidden //隐藏域 form标签是表单标签 action属性设置提交服务器的地址 method属性设置提交的方式 提交表单失败通常有三个原因 1.表单项没有name属性 2.单选、复选(下拉列表中的option属性)要 阅读全文
posted @ 2021-11-03 16:57 软工小蜗牛 阅读(189) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2021-11-02 20:32 软工小蜗牛 阅读(78) 评论(0) 推荐(0)
摘要: 1.实体类(entity):零散数据的载体 也就是说,你的表的名字是什么,就将类定义成什么名字,表中的每一列都定义一个私有变量,然后将每个变量设置get set 方法 在遍历的时候,将创建的类添加到一个集合里 阅读全文
posted @ 2021-11-02 19:21 软工小蜗牛 阅读(134) 评论(0) 推荐(0)
摘要: 将连接数据库的方法进行封装,并在别的类中进行使用,并且要声明静态方法, //1.获取连接 public static Connection getConnection() { Connection connection = null; try { Class.forName("com.mysql.j 阅读全文
posted @ 2021-11-02 17:03 软工小蜗牛 阅读(255) 评论(0) 推荐(0)
摘要: 创建PreparedStatement对象 PreparedStatement preparedStatement = connection.PreparedStatement(sql语句); 此时sql语句必须写好,不能通过一个变量再进行传入,因为PreparedStatement要做预编译 Pr 阅读全文
posted @ 2021-11-01 20:14 软工小蜗牛 阅读(399) 评论(0) 推荐(0)
摘要: 1.首先,要注册驱动 Class.forName("com.mysql.jdbc.Driver"); 2.连接数据库 String url = "jdbc:mysql://localhost:3306:数据库名称";//?&useUnicode=true&serverTimezone=UTC加这句话 阅读全文
posted @ 2021-11-01 19:02 软工小蜗牛 阅读(609) 评论(0) 推荐(0)