maven SQL 时区 bug(基本都是视频教程过时而导致的问题)
时区错误
报错信息: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 property) to use a more specifc time zone value if you want to utilize time zone support.
解决:把配置文件改为URL=jdbc:mysql://localhost:3306/elm?characterEncoding=utf-8&serverTimezone=CTT
@Override注解报红出现Undo Set language level to 6 - @Override in interfaces?
该问题的原因是java工程JDK的Language level 版本过低导致,@oveeide注解是在jdk6之后出来的,而我的工程中module中jdk Language level 用的是5,因此报红。
Information:javac 1.8.0_181 was used to compile java sources
报错原因:因为Idea中已经配置了jdk 1.8.0_181的版本,但Idea有几个地方的jdk版本被默认为1.6版本的jdk。
解决:
-
以下的全都要一致,均为1.8
连接数据库出现问题
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Caused by: javax.net.ssl.SSLException: Software caused connection abort: recv failed
Suppressed: java.net.SocketException: Software caused connection abort: socket write error
解决:
在配置文件的URL结尾加上 &autoReconnect=true
即URL=jdbc:mysql://localhost:3306/elm?characterEncoding=utf-8&serverTimezone=CTT&autoReconnect=true
报告SQL语法错误
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 'selet * from admin where adminName='wanglei' and password='123'' at line 1
错误 selet * from admin where adminName='wanglei' and password='123'
正确 select * from admin where adminName='wanglei' and password='123'
本文作者:mykaneki
本文链接:https://www.cnblogs.com/mykaneki/p/16750350.html
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步