Exception in thread “main“ java.lang.ClassNotFoundException: com.mysql.jdbc.Driver解决如此报错的问题
1.首先缺少一个jar包,在所在Modulel里面添加一个jar包下载地址:https://dev.mysql.com/downloads/file/?id=477058添加jar包后,又出现这样的错误,1.Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj
1.首先缺少一个jar包,在所在Modulel里面添加一个jar包
下载地址:https://dev.mysql.com/downloads/file/?id=477058
添加jar包后,又出现这样的错误,
1.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'这个数据驱动,新的数据库驱动是:The new driver class is `com.mysql.cj.jdbc.Driver'.
这个警告,不影响程序的运行,但是运行后控制台曝红,所改它。
在写程序时,注册数据库驱动时,写成最新的数据库驱动即可。
修改后:
2.Exception in thread "main" java.sql.SQLException: 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
这个是异常,服务器时区值无法识别或表示多个时区。
在连接的数据后面加上?serverTimezone=GMT,即可。
添加后:
做以上修改后,程序运行完美:
更多推荐
所有评论(0)