在程序运行时出现这个错误,为了避免以后再次遇到,在此记录一下。
Caused by: 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) ~[na:1.8.0_161] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_161] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_161] at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_161] at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:59) ~[mysql-connector-java-8.0.11.jar:8.0.11] at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:83) ~[mysql-connector-java-8.0.11.jar:8.0.11] at com.mysql.cj.util.TimeUtil.getCanonicalTimezone(TimeUtil.java:128) ~[mysql-connector-java-8.0.11.jar:8.0.11] at com.mysql.cj.protocol.a.NativeProtocol.configureTimezone(NativeProtocol.java:2201) ~[mysql-connector-java-8.0.11.jar:8.0.11] at com.mysql.cj.protocol.a.NativeProtocol.initServerSession(NativeProtocol.java:2225) ~[mysql-connector-java-8.0.11.jar:8.0.11] at com.mysql.cj.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:1391) ~[mysql-connector-java-8.0.11.jar:8.0.11] at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:895) ~[mysql-connector-java-8.0.11.jar:8.0.11] ... 77 common frames omitted
主要是因为升级了mysql连接驱动,如下
compile('mysql:mysql-connector-java:8.0.11')
从错误上看应该是时区的错误,所以我们只需要设置完毕系统的时区即可。
解决办法:在连接url中加入参数 serverTimezone=GMT%2B8,GMT%2B8代表东八区
jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&autoReconnect=true&serverTimezone=GMT%2B8
还有另外一种解决方法:设置整个数据库的时区
show variables like '%time_zone%' set global time_zone='+8:00';
相关推荐
我们可能会出现一个报错:java.sql.SQLException: Cannot create PoolableConnectionFactory (The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone....
»ý·ÖÖƹÜÀí×îÖ÷ÒªµÄ¹¦ÄÜÊÇÔö¼ÓÖƶÈÖ´ÐÐÁ¦¡£Ô±¹¤Î¥¹æ¡¢Î¥ÕµIJÎÓë²»³É¹¦²»ÔÙÖ±½Ó¹ÜÀí³É·Ö¡£Ö®Ç°²»Ö´ÐлòÎÞÖÜ...
ζȼì²âϵͳÔÚ¹¤ÒµÖв» 断±ä³ÉÇ°Ö÷ÒªµÄÒ»²¿·Ö£¬ÒòΪζȲÎÓëÁ˺ܶಿ·ÖµÄ¹¤³Ì²úÉú¡£ÔÚ±ê×¼µÄζȼì²âϵͳÖÐ...
安防系统通用图形符号.zipÊÄɼCADÍ¿dwg¸ÊÏÔ安防系统通用图形符号.zipÊÄɼCADÍ¿dwg¸ÊÏÔ 1.ʺÑÉÖ׸Öɼ²¿ 2.ʺ¸ÈÖ׸Öɼ²¿ 3.ʺ¹ËÖ׸Öɼ²¿
1. ¼¯Èº·þÎñÆ÷ÅäÖ㬰üÀ¨°²×°²Ù×÷ϵͳ¡¢¹Ø±Õ·À»ðǽ¡¢Í¬²½·þÎñÆ÷ʱÖӵȣ» 2. °²×°Cloudera ¹ÜÀíÆ÷£» 3. °²×°CDH ¼¯Èº£» 4. ...
³£¼ûÍøÕ¾±¸·ÝÎļþ×Öµä
¸ßЧÊÖ»úºÅÂë
λ¡£2 / 10Ãð»ðÐж¯×飺×÷ΪǿÖÆÎð²¡×飬³õʼ»¯·À»ð²Ù×÷£¬Ö÷Òª×÷ÓÃÓÚÉèÖ÷À»ðÇøÓò£¬Ö÷ÎÊ×éÖ¯·À»ðÉ豸²¢Ö¸³É¹¤×...
-- Èç¹û²»ÊǹÜÀíÔ±Éí·Ý£¬ÄÇôÉèÖÃʧ°Ü±ê¼Ç tbUserInfo = System.GetUserInfo(); if (tbUserInfo ~= nil) then if (not tbUserInfo.IsAdmin) then bRequirementFail = true...
ÖйúÎ÷·½ÎÄ»¯²»Ö¹²»¹ÜÖªÔò¡£Î÷·½ÎÄ»¯¿ÉÄܲ»ÈçÈå¼ÒÎÄ»¯Ò»Ñù¿ÉÒÔ×ö³öÖÜÎ÷ÎÄ×Ö¡£Î÷·½ÖÜÎ÷ÎÄ×Ö²»¹ÜÖªÔò¡£Î÷·½ÖÜ...
金典实例,数据结构光盘资源。 /* ´Ë³ÌÐòΪȫ¹ú½»Í¨×ÉѯģÄ⣻ ¾ßÓн»Í¨ÏµÍ³... ¿ª·¢Ê±¼äÊÇ2003.10¡ª¡ª2003.12£» ´Ë³ÌÐòΪ×îÖÕ°æ±¾£» */
¸ßЧÍøÕ¾ºǫ́Ŀ¼×Öµä
2. The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone解决方案 在使用MyBatis时,可能会遇到服务器时区值无法识别的问题。解决方案是,在application...
²»³£ÓÃÍøÕ¾±¸·ÝÎļþ×Öµä
³öÏÖÔÚ²»Í¬µÄ×Ó×ø±ê¡£Ò»²¿·Ö²úÆ·ÈçÎÒ¹úÖøÃûÆ·Åƺ£¶ûÔ¡°Ô£¬Ö±³ö³ÉΪÉîÎ÷¿É¿¿¡£Ö÷ÒòÔÚÓÚ“°Ô”±íʾ³öÆäÔÚͬ²¿Îï...
Ϊ×Ô¼º×ö³ö²¿·Ö²Î¿¼²é¿ö£¬ÎÒ¿ªÊ¼²ÎÓë³É¹¦×îÖØÒªµÄ×ܳɹ¦¿Î³Ì¡£ÎÒ³õʼ³É¹¦×ö³öÁ˲¿·Ö²Î¿¼²é¿ö£¬²»¹ýÎÒÈ·ÈÏ×Ô...
LECCO SQL Expert for sql server,Ò»¿îºÜºÃÓõÄSQLÓï¾äÓÅ»¯¹¤¾ß ѹËõ°üÀﺬÓÐ×¢²á»úºÍºº»¯Îļþ Èí¼þÆƽâ×¢²á¼°ºº»¯ËµÃ÷ Æƽⷽ...
//ºáÆÁ»¹ÊÇÊúÆÁ¿ØÖÆ£º0£¬ÊúÆÁ£»1£¬ºáÆÁ¡£ u16 wramcmd; //¿ªÊ¼Ð´gramÖ¸Áî u16 setxcmd; //ÉèÖÃx×ø±êÖ¸Áî u16 setycmd; //ÉèÖÃy×ø±êÖ¸...
¹ãÖÝÊÐÐÇÒíµç×ӿƼ¼ÓÐÏÞ¹«Ë¾ ×÷ÕߣºÕýµãÔ×Ó @ALIENTEK ************************************************/ //Êý×Ö±í const u8* kbd_tbl[9]={"¡û","2",...
//ʱÖÓÍ£Ö¹±êÖ¾ init_lcd(); clrram_lcd(); Init_DS18B20( ) ; //DS18B20³õʼ»¯ Initial_DS1302(); //ʱÖÓоƬ³õʼ»¯ up_flag=0; down_flag=0; done=0; //½øÈëĬÈÏ...