SQLException: No suitable driver found for jdbc:mysql://localhost:3306/xxxx
2016-09-22 13:00
851 查看
刚刚学习jsp,对着视频敲代码,报这个错误。
SQLException: No suitable driver found for jdbc:mysql://localhost:3306/shop
SQLState: 08001
VendorError: 0
问题,因为没有引入Driver类。
SQLException: No suitable driver found for jdbc:mysql://localhost:3306/shop
SQLState: 08001
VendorError: 0
问题,因为没有引入Driver类。
final String DBDRIVER = "org.gjt.mm.mysql.Driver"; String username = "root"; String password = "root"; String url = "jdbc:mysql://localhost:3306/shop"; Connection con = null; try { Class.forName(DBDRIVER); con = DriverManager.getConnection(url, username, password); } catch (SQLException e) { System.out.println("SQLException: " + e.getMessage()); System.out.println("SQLState: " + e.getSQLState()); System.out.println("VendorError: " + e.getErrorCode()); } catch (ClassNotFoundException e) { System.out.println("Class:" + e.getMessage()); }加上Class.forName("xxxx")就OK了
相关文章推荐
- java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/
- java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/
- mondrian java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/foodmart
- java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306
- java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/airline
- android studio下解决 java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/
- java.sql.SQLException: No suitable driver found for jdbc:mysql:/localhost/XXX?还是没有解决
- java.lang.ClassNotFoundException: com.mysql.jdbc.Driver 与No suitable driver found for jdbc:mysql://localhost:3306/XXXx的问题解决方案
- java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/
- HIVE:No suitable driver found for jdbc:mysql://localhost:3306/hive
- no suitable driver found for jdbc:mysql//localhost:3306/qzhao 错误__Jemeter
- Weka连接数据库出现No suitable driver found for jdbc:mysql://localhost/dbname
- 调试经验-java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@localhost:1521:orcl
- java.sql.SQLException: No suitable driver found for jdbc:mysql
- no suitable driver found for jdbc:mysql//localhost:3306/..
- 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:3306/book?useUnicode=true&characterEncoding=UTF-
- No suitable driver found for jdbc:mysql://localhost/dbname
- No suitable driver found for jdbc:mysql://localhost:3306/ 问题