No suitable driver found for jdbc:mysql://localhost:3306/book?useUnicode=true&characterEncoding=UTF-
来源:互联网 发布:佛山美工设计 编辑:程序博客网 时间:2024/06/06 03:29
启动项目时出错,错误信息如下:
首先代码没有错误,并且导入了mysql jar包
public class DbConnection { //public String url="jdbc:mysql://172.16.52.73:3307/student?useUnicode=true&characterEncoding=UTF-8"; //public String dbpwd="123456"; public String url="jdbc:mysql://localhost:3306/book useUnicode=true&characterEncoding=UTF-8"; public String dbuser="root"; public String dbpwd=""; public Connection con=null; public Connection connection() throws SQLException{ try { con= DriverManager.getConnection(url, dbuser, dbpwd); return con; } catch (SQLException e) { e.printStackTrace(); return null; } } public void close(Connection con,PreparedStatement ps,ResultSet rs) throws SQLException{ if(con!=null){ con.close(); } if(ps!=null){ ps.close(); } if(rs!=null){ rs.close(); } }}
java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/book?useUnicode=true&characterEncoding=UTF-8at java.sql.DriverManager.getConnection(Unknown Source)
解决方法是将MySQL-connector-Java-3.1.14-bin.jar的jar包加入C:\Program Files\Java\jre1.6.0_02\lib\ext文件夹下,问题解决。
阅读全文
1 0
- No suitable driver found for jdbc:mysql://localhost:3306/book?useUnicode=true&characterEncoding=UTF-
- No suitable driver found for jdbc:mysql://localhost:3306/book?useUnicode=true&characterEncoding=UTF-
- No suitable driver found for jdbc:mysql://192.168.1.74:3306/se?useUnicode=true&characterEncoding=utf
- url=jdbc:mysql//localhost:3306/spring_dao?useUnicode=true&characterEncoding=UTF-8
- No suitable driver found for jdbc:mysql://localhost:3306/ 问题
- No suitable driver found for jdbc:mysql://localhost:3306/stu_mis
- no suitable driver found for jdbc:mysql//localhost:3306/..
- No suitable driver found for jdbc:mysql://localhost:3306/ 问题
- no suitable driver found for jdbc:mysql//localhost:3306/..
- No suitable driver found for jdbc:mysql://localhost:3306/****
- No suitable driver found for jdbc:mysql://localhost:3306/test
- No suitable driver found for jdbc:mysql://localhost:3306/shop_01
- no suitable driver found for jdbc:mysql//localhost:3306/..
- No suitable driver found for jdbc:mysql://localhost/mysql
- url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&characterSetResults=ut
- No suitable driver found for jdbc:mysql://localhost/shop
- jdbc:mysql://localhost:3310/hibernate?useUnicode=true&characterEncoding=gb2312
- mondrian java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/foodmart
- 详细解读Ian Goodfellow ICCV2017演讲PPT《解读GAN的原理与应用》
- Android之如何集成第三方组件或框架
- ubuntu shell查找文件夹 和 文件
- 2卷积神经网络相关API详解-2.2TensorFlow之池化操作API
- C#数组
- No suitable driver found for jdbc:mysql://localhost:3306/book?useUnicode=true&characterEncoding=UTF-
- Curling 2.0 (POJ 3009, 深度优先搜索)
- 一个很好的程序员大赛作品需要被更多的人知道
- 稀奇古怪的问题
- 第七周 项目2
- Android自定义相机开发
- hadoop集群搭建
- C# 八种方案打印PDF文档
- ios图形处理类似于eChart开源框架