![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
jdbc
word小埋
这个作者很懒,什么都没留下…
展开
-
jdbc中时区报错以及中文输入变成?的解决办法
1.出现时区报错 The server time zone value ‘�й���ʱ��’ is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration propert...原创 2019-08-04 18:07:35 · 244 阅读 · 0 评论 -
jdbc实现用户登录例子
编写判断方法 1.判断传入的username 和password是否在数据库中返回boolean public boolean login(String username,String password) { if (username == null||password == null) { return false; } ...原创 2019-08-05 18:13:39 · 990 阅读 · 0 评论 -
jdbc事务相关演示
开启事务 Connection conn=null; conn = JDBCUtils.getConnection(); //利用工具类获取数据库连接并赋值变量 conn.setAutoCommit(false); //开启事务 fales为手动提交事务 true为自动提交事务 提交事务 conn.commit(); //在更新语句的最后提交事务 回滚事务 catch (Exceptio...原创 2019-08-06 10:44:49 · 127 阅读 · 0 评论 -
jdbc利用druid连接池技术编写jdbcutils工具类以及其应用实例
编写连接池工具类JDBCDruidUtils 1.定义连接池类并编写静态代码块 private static DataSource ds; //定义数据池 static { try { //1.加载配置文件 建立properties集合通过类加载器加载配置文件 Properties pro = new Properties();...原创 2019-08-06 13:24:19 · 820 阅读 · 0 评论 -
jdbc利用spring框架中的template来实现功能并简化代码
利用spring框架中的template来实现 1.导入jar包 并设置为Add as library spring框架包以及mysql连接包 以及 commons日志包 最后是druid连接池 2.编写配置文件 可随意命名 一般命名为druid.properties diverClassName=com.mysql.cj.jdbc.Driver url=jdbc:mysql:///test?...原创 2019-08-06 19:10:40 · 164 阅读 · 0 评论