JDBC连接总结:

JDBC连接总结:,第1张

JDBC连接总结: 1.java连接mysql数据库时错误提示如下:

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

中文翻译为:

加载类“com.mysql.jdbc.Driver”。这是弃用。新的驱动程序类是' com.mysql.cj.jdbc.Driver'。驱动程序是通过SPI自动注册的,手动加载驱动程序类通常是不必要的。

上述提示:是原驱动程序已经弃用了,需要更改为新的注册驱动程序。

更改注册驱动参数如下:

原注册驱动:

Class.forName("com.mysql.jdbc.Driver");

更改后的注册驱动:

Class.forName("com.mysql.cj.jdbc.Driver");

报错信息:Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

2. Exception in thread "main" java.lang.ClassNotFoundException: com.mysql.cj.jbdc.Driver 工具类路径写错了

3. Exception in thread "main" java.sql.SQLException: Access denied for user 'roo'@'localhost' 数据库连接时,密码写错了

 

4. Exception in thread "main" java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'password=''' at line 1

Sql语法错误

 

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5684393.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存