摘要:
1.创建Servlet类继承HttpServlet /** * 设置缓存 * 设置缓存时间 */@WebServlet("/test11") //使用注解映射Servlet资源访问路径public class ServletTest11 extends HttpServlet { protected 阅读全文
摘要:
1.创建类 public class JDBC { public static void main(String[] args) { Connection connection = null; PreparedStatement statement = null; ResultSet resultS 阅读全文
摘要:
1.使用反射机制,获取Driver类对象 //1.加载jdbc驱动类 try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); }为什么使用反射机制可 阅读全文
摘要:
1.创建jdbc.properties配置文件,填写基本信息 2.在jdbc类中,使用工具类读取properties配置文件,获取文件里的key-value值。 package com.itheima.jdbc; import java.util.ResourceBundle; public cla 阅读全文
摘要:
1.创建jdbc.properties配置文件,填写基本信息 2.在jdbc类中,使用工具类读取properties配置文件,获取文件里的key-value值。 //创建数据库连接 //ResourceBundle是读取properties配置文件的工具类 //com.itheima.jdbc.jd 阅读全文