栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

JDBC连接总结:

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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语法错误

 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/683836.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号