IDEA连接数据库错误:java.lang.RuntimeException: com.mysql.cj.exceptions.InvalidConnectionAttributeException:
问题描述:在使用IDEA连接数据库时,已经将JDBC驱动导入lib文件夹,但连接过程中依旧提示如下错误????java.lang.RuntimeException: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value '�й���ʱ��' is unrecognized o
·
问题描述:
在使用IDEA连接数据库时,已经将JDBC驱动导入lib文件夹,但连接过程中依旧提示如下错误👇
java.lang.RuntimeException: com.mysql.cj.exceptions.InvalidConnectionAttributeException: 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.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85)
在此处需要对url进行设置:jdbc:mysql://localhost:3306/数据库名?参数1&参数2&参数3…
jdbc:mysql://localhost:3306/jdbcstudy?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC
具体效果如图:
注:
因为提示信息只涉及到serverTimezone参数,故只设置这一个参数同样可以连接成功。
亲测有效,具体看图👇
更多推荐
已为社区贡献1条内容
所有评论(0)